Saturday, June 1, 2013

Datetime Conversion error

What is the exact error you are getting?


I am not able to replicate the issues as below:



DECLARE @temp TABLE
(
[Rank] INT ,
Value VARCHAR(100)
)

Insert into @temp Select 1,'2012-01-01 00:00:00'
Insert into @temp Select 1,'2013-01-10 00:00:00'
Insert into @temp Select 1,'2012-01-20 00:00:00'
Insert into @temp Select 1,'2012/01/20'

;WITH WCTE AS(
Select [Rank], Convert(DateTime,Value,110) ServiceDate2
from @temp
Where 1=1
)SELECT * FROM WCTE
where ServiceDate2 >= '2012-01-01 00:00:00.000'
order by 1






Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful.


No comments:

Post a Comment