No, that is not legal. From the manual:

"Default values must be constants. This means, for example, that you cannot
set the default for a date column to be the value of a function such as
NOW() or CURRENT_DATE."

http://www.mysql.com/doc/C/R/CREATE_TABLE.html


-----Ursprungligt meddelande-----
Från: Pete, Rose & Kristina [mailto:[EMAIL PROTECTED]]
Skickat: den 21 november 2001 10:25
Till: [EMAIL PROTECTED]
Ämne: Is DATE NOT NULL DEFAULT NOW() legal??


Hi there.

I'm getting stuck on what seems only too simple to me:


CREATE TABLE Waverley.MemberPrice
  (
  PriceID TINYINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
  Price FLOAT(5,2) NOT NULL,
  ActivePrice TINYINT UNSIGNED NOT NULL DEFAULT 1,
  CreatedDate DATE NOT NULL DEFAULT NOW(),
  DeActivatedDate DATE,
  DeActivatedBy TINYINT UNSIGNED NOT NULL DEFAULT 0
  );

I get an Error 1064 on the NOW().  If I take the DEFAULT NOW() out, then it
works perfect.

I'm using 3.22.32, if that helps.

Thanks if you can help.

Peter.





---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to