MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:mos Date:February 10 2004 10:04pm
Subject:Re: Adding NOW() to existing INSERT statement?
View as plain text  
At 01:55 PM 2/10/2004, you wrote:
>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)
>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',
>'widget@stripped', 'Glendale', 'CA', 'USA ',
>'', 'Tuesday, February 10,
>2004 ', 'Widgets for sale', '')
>Anybody know how to do this?
>Many thanks in advance,

         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.


>Do you Yahoo!?
>Yahoo! Finance: Get your refund fast by filing online.
>MySQL General Mailing List
>For list archives:
>To unsubscribe:

Adding NOW() to existing INSERT statement?Bob Afifi10 Feb
  • Re: Adding NOW() to existing INSERT statement?mos10 Feb
  • Re: Adding NOW() to existing INSERT statement?Bob Afifi11 Feb