dbTalk Databases Forums  

default value not working in create table call

comp.databases.btrieve comp.databases.btrieve


Discuss default value not working in create table call in the comp.databases.btrieve forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
mbosco51@hotmail.com
 
Posts: n/a

Default default value not working in create table call - 02-22-2005 , 03:58 PM






Hi, I am having a problem creating a table with a timestamp field that
defaults to the current date/time. I've created tables with defaults
on varchar or interger fields, but I can't get this working. Here is
my script...

CREATE TABLE TableName
(
Field1 IDENTITY NOT NULL,
Field2 varchar(20) NULL CASE,
Field3 timestamp DEFAULT NOW NULL
)

The error I get when I run this is: "No default value assigned for
column <Field3>."

Any ideas? Thanks.


Reply With Quote
  #2  
Old   
Bill Bach
 
Posts: n/a

Default Re: default value not working in create table call - 02-28-2005 , 11:53 AM






The DEFAULT clause is documented thus in Pervasive.SQL V8:

column-definition ::= column-name data-type [ DEFAULT default-value ]
[ column-constraint [ column-constraint ]... [CASE | COLLATE
collation-name ]
default-value ::= literal
literal ::= 'string'
Quote:
number
{ d 'date-literal' }
{ t 'time-literal' }
{ ts 'timestamp-literal' }
Note that the value provided to the DEFAULT string is a Literal, and a
literal is defined as a constant value. It is not legal (at least in
this version) to have a function (e.g. NOW()) in this slot.
Goldstar Software Inc.
Building on Btrieve(R) for the Future(SM)
Bill Bach
BillBach (AT) goldstarsoftware (DOT) com
http://www.goldstarsoftware.com
*** Pervasive.SQL Service & Support Classes ***
Coming Soon: Pervasive DataExchange Training!


mbosco51 (AT) hotmail (DOT) com wrote:

Quote:
CREATE TABLE TableName
(
Field1 IDENTITY NOT NULL,
Field2 varchar(20) NULL CASE,
Field3 timestamp DEFAULT NOW NULL
)

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.