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',
'25/06/2004',
'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
DanHi,
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.
HTH
Thanks
Shankar
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment