having problem using datadiff, getting conversion failed when converting date...from character string
Posted on 2010-09-20
I have a couple of date fields. If I just do select date1, date2 from tbl. They look the same (like regular date/time fields). If I do
select DateDiff(dd, date1, GetDate())
this one gets the error
select DateDiff(dd, date2, GetDate())
this also gets the same error
select DateDiff(dd, cast(date2 as datetime), GetDate())
So, I'm thinking date2 is a string, but, why does it look like a date if selected alone and how do I tell what data type it is?
How do I get it to work with the datediff?