CodeGuru Forums - Convert a Varchar in a DateTime SELECT * FROM tab_val WHERE (CASE ISDATE(val) WHEN 1 THEN CAST(val As DateTime) ELSE NULL END) > CAST('2003-05-05 08:00:00.000' As DateTime) ------------------- When casting a varchar to a datetime it is critical that all the datetime pieces (such as minutes, seconds...) are in the string. Otherwise an error will be thrown.
No comments:
Post a Comment