List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:June 28 2001 3:28pm
Subject:Re: Creating Table with a Default Datetime field
View as plain text  
At 11:57 AM +0200 6/28/01, Kaneda K wrote:
>At 10:38 27/06/2001 -0700, you wrote:
>>Sorry, for quoting the manual but this might be just another example where
>>it could have the answer right away:
>>Hannes
>>
>>http://www.mysql.com/doc/D/A/DATETIME.html
>
>On my own mysql version :
>  Date TIMESTAMP default "now()",
>Works correctly, the date is YYYYMMDDHHmmss format, but the values 
>are set automattically and correctly, so, could it be your mysql 
>version ?

It works as you seem to expect, but not for the reason you think.
If you try SHOW COLUMNS FROM tbl_name, I expect you'll find that MySQL
ignored your default value specification and set it to NULL.

In any case "now()" is a string, not a function call.  What you've
really attempted to do is set the default value to a literal string,
not a function that evaluates to the current date and time.


>
>
>------------------
>System Info :
>Red Hat Linux release 6.2 (Zoot)
>     Kernel 2.2.14-5.0 on an i686
>Mysql Ver 11.12 Distrib 3.23.32
>java version "1.3.0"
>     Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0)
>     Java HotSpot(TM) Client VM (build 1.3.0, mixed mode)
>JDBC Driver : mm.mysql-2.0.4-bin.jar
>Tomcat 3.2 beta 3


-- 
Paul DuBois, paul@stripped
Thread
Creating Table with a Default Datetime fieldRichard Bates26 Jun
  • RE: Creating Table with a Default Datetime fieldRavi Raman26 Jun
    • Re: Creating Table with a Default Datetime fieldPete Harlan27 Jun
      • Re: Creating Table with a Default Datetime fieldHannes Niedner27 Jun
        • Re: Creating Table with a Default Datetime fieldKaneda K28 Jun
          • Re: Creating Table with a Default Datetime fieldPaul DuBois28 Jun
      • Re: Creating Table with a Default Datetime fieldSherzod Ruzmetov27 Jun
        • RE: Creating Table with a Default Datetime fieldRavi Raman27 Jun
          • RE: Creating Table with a Default Datetime fieldSherzod Ruzmetov27 Jun
            • RE: Creating Table with a Default Datetime fieldRavi Raman27 Jun
              • RE: Creating Table with a Default Datetime fieldSherzod Ruzmetov27 Jun
      • Re: Creating Table with a Default Datetime fieldGerald Clark27 Jun
      • Re: Creating Table with a Default Datetime fieldRich Duzenbury27 Jun
      • Re: Creating Table with a Default Datetime fieldGerald Clark28 Jun