Hugo Kornelis (11/28/2011)
Using single quotes for both strings and dates is a brain-dead design decision--period.
Technically, T-SQL is not using single quotes for both strings and dates. It uses single quotes for strings only.
There is no way to have date literals in T-SQL; that's why we have to make do with string literals that will be converted (at execution time) to date or datetime values.
Single quotes ARE for strings only, true. So the trouble comes from our getting used to implicit conversions and expecting them based on our human experience. As may have been noticed in the past, MS SQL is not human ;-) . We either have to remind ourselves to consider datatypes (as so many QODs do), or look for MS to require explicit conversion, either with a CAST/CONVERT or special delimiters as with the suggested pound-sign notation #2011-11-28#
. If I'm voting, I say leave it as is and stay alert.