Tuesday, September 19, 2006

 

Sept or Sep? Arrgghhh!

I always forget about this until I have to work with data in the month of September...

------------------------------------------------------------------------------------------------------------------------

Microsoft SQL Server does not think 'Sept 6, 2006' is a date and, if you try to say WHERE TheDate >= 'Sept 6, 2006', it says:

Msg 241, Level 16, State 1, Line 1
Conversion failed when converting datetime from character string.

Try it:

SELECT CAST('Sept 6, 2006' AS DATETIME) -- fails with syntax error

SELECT CAST('Sep 6, 2006' AS DATETIME) -- succeeds

------------------------------------------------------------------------------------------------------------------------

Will you remember next year? I hope I do!


AddThis Social Bookmark Button

Comments: Post a Comment

Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?