List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:September 19 2002 1:37am
Subject:Re: date field - default value = current date
View as plain text  
At 1:32 -0700 9/18/02, neal wrote:
>Is there a wat to have mySQL auto fill in the current date into my
>dateCreated field?
>
>In SQLServer I would simply specify the getDate() method as a default value.
>I presume I would use the analogous MySQL function curDate() but it does not
>appear to work for me.

It's better to read the manual than to presume.  In this case, the
presumption is incorrect.  Default values in MySQL must be constants.

However, you might find the TIMESTAMP column type helpful.
I'll let you read about it in the manual. :-)

http://www.mysql.com/doc/en/DATETIME.html

>
>Any suggestions?

Thread
Connect to Database over the InternetBryan18 Sep
  • determine value of auto-increment field after adding record - @ runtimeneal18 Sep
    • date field - default value = current dateneal18 Sep
      • Re: date field - default value = current dateMikhail Entaltsev18 Sep
      • re: date field - default value = current dateEgor Egorov18 Sep
      • Re: date field - default value = current datePaul DuBois19 Sep
    • Re: determine value of auto-increment field after adding record - @ runtimepeter.brawley18 Sep
    • re: determine value of auto-increment field after adding record - @ runtimeEgor Egorov18 Sep
  • RE: Connect to Database over the InternetJindo18 Sep
    • RE: Connect to Database over the InternetBryan19 Sep
  • RE: Connect to Database over the InternetMike Hillyer18 Sep