I'm trying to get a fixed entry date using two DATETIME fields (dt_update, dt_create). The first DATETIME field (dt_update) automatically updates each time the record is modified, the second DATETIME field (dt_create) doesn't.
I've been able to get it using this:
INSERT INTO `test` SET dt_create = NOW()
However, what I really need is to have the above INSERT statement (or something that does the same thing) integrated into another INSERT statement which looks something like this:
INSERT INTO `test` (`Title`, `Email`, `City`, `State`, `Country`, `URL`, `Date`, `Description`, `rid`) VALUES ('Widget', '[EMAIL PROTECTED]', 'Glendale', 'CA', 'USA ', 'http://www.widget.com', 'Tuesday, February 10, 2004 ', 'Widgets for sale', '')
Anybody know how to do this?
Many thanks in advance,
-Bob
Bob,
If you insert a NULL into a DateTime column that does not allow nulls, it will set it to the current date & time. So just replace your 'Tuesday, February 10,
2004 ' (which btw won't work because it has the wrong date format, should be '2004-02-10') with NULL.
Mike
__________________________________ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]