Robert Adkins mailto:[EMAIL PROTECTED]
on Friday, October 15, 2004 12:23 PM said:
INV_DATE DATETIME DEFAULT NOW() NOT NULL,
);
I receive an error message stating that there is an error with
'NOW()'
[snip]
Is there a very different method of doing this
If you make that column a TIMESTAMP data type and leave the default as
NULL, it will automatically use the current date/time if no value is
entered.
Please note, this will only work this way for the first TIMESTAMP column
in the table.
Also, if ever you update a row containing TIMESTAMP
hi
you might want to look at TIMESTAMP which does it all for you.
Peter
-Original Message-
From: Robert Adkins [mailto:[EMAIL PROTECTED]
Sent: 15 October 2004 20:23
To: MySQL General List
Subject: Command that I believe should work...
...but doesn't.
I am attempting to
Defaults must be constants, not functions. If you want a DATETIME which
defaults to NOW(), then you probably really need a TIMESTAMP
http://dev.mysql.com/doc/mysql/en/DATETIME.html.
Michael
Chris W. Parker wrote:
Robert Adkins mailto:[EMAIL PROTECTED]
on Friday, October 15, 2004 12:23 PM
Only static data is allowed as default-values; functions, derived data
etc, are not allowed.
An unfortunate shortcoming.
On the flipside, there is some weird rule that the first timestamp in a
table will be set with the current date/time during an insert if the
column is left out of the insert
TIMESTAMP, at least by the book in front of me, is only valid from
January 1, 1970 to December 31, 2037. I want to avoid using something
that could create a Y2037 issue, if whatever I build ends up lasting
that long. To me, that is a potential hazard and thus would be a bad
habit to get