A blog about SQL Server, SSIS, C# and whatever else I happen to be dealing with in my professional life.

Find ramblings

Wednesday, February 18, 2009

TSQL protip

SELECT T.* FROM dbo.MYTABLE T WHERE T.last_mod_date > 2008-12-10
That is not the same as
SELECT T.* FROM dbo.MYTABLE T WHERE T.last_mod_date > '2008-12-10'

The first one is going to turn the "date" into an integer and then
cast as a date which isn't quite what I was anticipating.
SELECT T.* FROM dbo.MYTABLE T WHERE T.last_mod_date > 1994

And now with that crisis solved, I'm making a cup of tea to wake up
from being a noob.

No comments: