From: Plamen Ratchev on
Justin D. wrote:
> The data type is, actually, Varchar 50 and it shows up as
> 2008-03-24 00:00:00
>

Then you are using wrong format style to convert it. Try this:

SELECT DATEDIFF(DAY,
CURRENT_TIMESTAMP,
CONVERT(DATETIME, CASE WHEN ISDATE(tblMain.dtOpen) = 1
THEN tblMain.dtOpen
END, 120))

--
Plamen Ratchev
http://www.SQLStudio.com
First  |  Prev  | 
Pages: 1 2
Prev: DB Connection Pooling
Next: TOP clause