Writing ugly SQL Statements is an art. Today I’ve spent
a few minutes trying to break our parser as well as giving
a grill to SQL Server’s parser.
So here is some extra syntax that is not behaving as
I’d expect it to behave.
— Yes, this is legal, surprise surprise it returns a
— table with a single column, a single row, the value
— is 1, the column name is “a” !
— So let’s push it a bit further:
Works, the result is:
Wow, this works too, and it gives me
So can I just put anything after the ?decimal? point?
— But then there are exceptions:
select 1.a, 1.e, 0.a
———– ———————- —————-
1 1 0.0
1.e does not produce the alias (e for exponent???),
0.a seems to use float, so the value displayed is 0.0
It is a shame that you cannot use this with string literals.
Unless you want to torture your colleagues I reckon that
the above is absolutely useless. But if you have an idea why
the above works, and works the way it works, do let me know.
PS: the above syntax works on 2000,2005 and 2008.