How to convert a "dd/mm/yyyy" string to datetime in MSSQL ?

Posted by Sim on Stack Overflow See other posts from Stack Overflow or by Sim
Published on 2010-05-06T11:26:16Z Indexed on 2010/05/06 11:28 UTC
Read the original article Hit count: 159

Filed under:
|
|
|

I tried this

SELECT convert(datetime, '23/07/2009', 111)

but got this error

The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.

However

SELECT convert(datetime, '07/23/2009', 111)

is OK though

How to fix the 1st one ?

Thanks

© Stack Overflow or respective owner

Related posts about tsql

Related posts about convert