#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    haltern, germany
    Posts
    2
    Rep Power
    0
    when creating a table, i tried to define
    a default value for a date column.
    'contact date not null default "now()",'
    this doesnt do anything.
    is it possible to define a default (sysdate) for date columns under mysql?

  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    18
    Remove the double quotes from around now() so mysql knows you are defaulting to a function. With quotes it tries to insert the text "now()" which isn't valid for a date field and results in zeroes.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    haltern, germany
    Posts
    2
    Rep Power
    0
    mysql>
    mysql> create table test (name varchar(32), datum date default now());
    ERROR 1064: You have an error in your SQL syntax near 'now())' at line 1
    mysql>

    i tried this too, but...
    do you have another suggestion?

Similar Threads

  1. Controlling relay in qmail
    By prashant_!012 in forum Mail Server Help
    Replies: 5
    Last Post: December 20th, 2009, 08:34 AM
  2. Two Steps Query ?
    By Fabiop in forum MySQL Help
    Replies: 5
    Last Post: February 16th, 2004, 11:16 AM
  3. Replies: 5
    Last Post: January 11th, 2004, 08:19 PM
  4. qmail receive error
    By AlmightySam in forum Mail Server Help
    Replies: 13
    Last Post: December 29th, 2003, 09:09 AM
  5. Need urgent help
    By nsiindia in forum MySQL Help
    Replies: 2
    Last Post: November 28th, 2003, 12:15 PM

IMN logo majestic logo threadwatch logo seochat tools logo