SQL Datetime Convert Error -
i have have sql statement returns following error:
the conversion of varchar data type datetime data type resulted in out-of-range value.
select * ebv_platz (adrid = 4436) , (id <> 5) , (status = 1) , (convert(datetime, '01.03.2014', 102) >= placefrom) , (convert(datetime, '01.03.2014') <= placeto) or (convert(datetime, '31.03.2014') >= placefrom) , (convert(datetime, '31.03.2014') <= placeto) but 1 works fine , difference date values:
select * ebv_platz (adrid = 4436) , (id <> 5) , (status = 1) , (convert(datetime, '01.01.2000', 102) >= placefrom) , (convert(datetime, '01.01.2000') <= placeto) or (convert(datetime, '01.06.2001') >= placefrom) , (convert(datetime, '01.06.2001') <= placeto) i don't understand this. can me?
i'm betting second 1 not work fine, rather converts dates january 06 , january 01.
you need give hint using day month year format.
try instead:
(convert(datetime, '31.03.2014', 103) the 103 (from msdn) interprets date dd/mm/yy
as @alexk noted in comments, these dont need converted. use strings long in better format.
my assumption here using mssql. different platform, syntax different.
Comments
Post a Comment