insert date in sql

Results 1 to 2 of 2

Thread: insert date in sql

  1. #1
    fred Guest

    Default insert date in sql

    Hi, I´m having problems inserting a date value in sql. I get the input from a form that uses the format YYYY-MM-DD, this is t code<BR><BR>tmpdate = Request.Form("date")<BR><BR>INSERT INTO tabelname (date) VALUES ("& tmpdate &")<BR><BR>The code runs without errormessages but the value in the SQL 7.0 database is corrupt. If I input 2001-05-06 the value ends up 1905-06-14.<BR><BR>Thanks in advance!

  2. #2
    Join Date
    Dec 1969

    Default RE: insert date in sql

    You need to quote your date.<BR><BR>INSERT INTO tabelname (date) VALUES (&#039;"& tmpdate &"&#039;)"<BR><BR>I&#039;d also change the name of the date field to something else. I&#039;m surprised SQL Server didn&#039;t complain about that when you were designing the table.<BR>

Posting Permissions

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