Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2005
    Posts
    266

    Unanswered: dateInsert SMALLDATETIME NULL DEFAULT getdate for MySQL

    I am looking for the equivalent of MS SQL

    dateInsert SMALLDATETIME NULL DEFAULT getdate()

    for mySQl 5

    i am trying

    dateInsert DATETIME NULL DEFAULT NOW()

    but it doesnt work

    thank you for helping

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    dateInsert TIMESTAMP

    will also update every time the row is changed
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Dec 2005
    Posts
    266
    thank you r967 but I only want to store the dateInsert once to sort or search datas latter on the INSERT date, is there anything for mysql ?

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    dateInsert DATETIME

    unfortunately you cannot set the DEFAULT value to a function like NOW()
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Dec 2005
    Posts
    266
    ok thank you

Posting Permissions

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