from varchar to datetime conversion | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

from varchar to datetime conversion

Has anyone even had problem with conversion from varchar to datetime?
For example, fld_1 is defined as datetime but when I do insert, I simply do insert tbl_name (fld_1) values (‘2003-09-01’) sometimes, this column still shows NULL after above insert.

Can’t say that I have seen this problem before… This is year month day presumably? Is it particular dates causing problems? Any errors returned? Cheers
Me neither. Datetime format looks fine and a bad format would have result an error, not insert NULL.
You could set the datetime field to not null if you want to fail this insert. From where are you running the insert? If from an application, try to run a trace and see what arrives to the database. Bambola.
try inserting (‘2003-15-12’) and then try (‘2003-12-15’) This way you will be able to determine what the required format is. Regards,
Ravi I lent a friend $5000 for plastic surgery and now I don’t know what he looks like – Unknown