Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003

    Unanswered: date problems (AGAIN!)

    I am trying to use asp to add/edit dates in a sql server db.

    I can add a date fine using: -

    INSERT INTO news(news_title, news_date, news_intro, news_text)
    VALUES('The title of the news',
    'This is the introduction to the news article',
    'this is the text for the news')

    however when i try to update using: -

    update news set news_date='23/05/2004' WHERE news_id = 11

    I get the following error: -

    Server: Msg 242, Level 16, State 3, Line 1
    The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
    The statement has been terminated.

    the date column is of the datatype datetime
    I also have the same problem if i use the same sql directly in query analyzer

    Any help HUGELY appreciated, cheers


  2. #2
    Join Date
    Jan 2004

    Date Problem


    The way you pass the date format to the SQL should be in mm/dd/yyyy.
    Unless you specifially use the Convert Function, you will have to use this in this format. The reason is because there is a default configuration (I dont know where it is :-) ) that takes the date in this format.


Posting Permissions

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