SQL Server 2008 VarChar To DateTime -


i have table unfortunately number of dates stored strings.

i have number of reports cast them datetimes , filter them. working fine until today when of sudden i'm getting error

"the conversion of varchar data type datetime data type resulted in out-of-range value."

the dates stored in format of "yyyy-mm-dd" , valid.

if run following sql statement

select cast('2010-06-02' datetime)  

i expect "2010-06-02" of today i'm getting "2010-02-06" has changed way sql formats dates. i've had in regional settings on server , looks correct.

what else causing this?

an unambiguous way of getting conversion following:

select cast(replace('2010-06-02', '-', '') datetime)  

and interpreted yyyymmdd, ignoring set dateformat ydm declaration or cultural settings database has.


Comments

Popular posts from this blog

unicode - Are email addresses allowed to contain non-alphanumeric characters? -

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -