compare varchar in a query as a datetime
Posted on 2010-01-12
table was design a while ago as:
id uniqueidentifier not null,
this query fails:
select count(*) as AssetsSold from Tab
where isdate(solddate) = 1
and solddate is not null
between convert(datetime,'10/1/2009',101) and convert(datetime,'1/1/2010',101)
with the following error:
"Conversion failed when converting datetime from character string."
how can I pull these (varchar) values and compare them as dates?