Results 1 to 2 of 2

Thread: [RESOLVED] Defining field's default value as a SQL function call

  1. #1

    Thread Starter
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Resolved [RESOLVED] Defining field's default value as a SQL function call

    Howza,

    I'm trying to get a SQL server script working in mySQL.

    mySQL does not like one element of the syntax, the issue appears to be using afunction call (such as CURDATE()) as the default value for a field, in the table definition syntax.

    Is there a correct syntax for this, or does mysql not support this

    Example:
    Code:
    create table tablename (
     ...
     fieldname datetime not null default(curdate())
     ...
    );
    Cheers
    - P

  2. #2

    Thread Starter
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Defining field's default value as a SQL function call

    Got it (in this case anyway)

    Code:
    fieldname timestamp
    DId not google hard enough...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width