sql - Same queries giving error -
can please explain why first query gives error , second query doesn't?
select * employee empdate < '20.06.2013 09:11:00 ' select * employee empdate < '11.04.2013 14:40:00 '
the first query causes error
the conversion of varchar data type datetime data type resulted in out-of-range value.
really hard understand when passing same date format both queries. column data type empdate
datetime
. wrong here?
i using sql server 2012
in case looks can use:
select convert(datetime,'20.06.2013 09:11:00',103)
to convert date format proper datetime comparison:
select * employee empdate < convert(datetime,'20.06.2013 09:11:00',103)
the third parameter of convert()
function defining 'style', can see list of formats here: cast , convert - date , time styles
Comments
Post a Comment