RE: Datetime Defaults
Posted in 1998
Troy Peterson wrote:
>
> In dbaccess I get a "591: Invalid default value for column/variable
> (time_stamp)" when I try to create a field in my table as follows:
>
> time_stamp DATETIME YEAR TO SECOND DEFAULT CURRENT NOT NULL
>
>
> Why is it balking at the use of "CURRENT"? I tried "TODAY" but it
didn't
> work either.
>
> Thanks for any light anyone can shed on this.
>
>
Troy,
Try this:
time_stamp DATETIME YEAR TO SECOND DEFAULT CURRENT YEAR TO
SECOND NOT NULL
It will work. It seems strange that this should be essential -
generally in the manuals there is a lot of discussion about how the bits
of a DATETIME or EXTEND() that are left out are defaulted, and how
additional precision is just truncated. But in the CREATE TABLE
statement, it seems necessary to be this explicit.
Hope that helps
RET
+------------------------------------------+
| Richard Thomas |
| DBA - Marketing Information Systems |
| Optus IT |
| email: richard_thomas@yes.optus.com.au |
| Ph: +61 2 9342 7188 |
| "My opinions are my opinions" |
+------------------------------------------+