Blog Post

No space queries

,

You know, sometimes you get a silly idea in your head and you just HAVE to try it out. The idea? Can I write a query without any white space? No spaces, no carriage returns etc. As it happens, yes. Yes I can.

SELECT*FROM[Person].[Person]WHERE[LastName]='Duffy';

You’ll notice I had to use brackets to make it work. So just for fun here is another version without the brackets but using carriage returns instead.

SELECT
*
FROM
Person
.
Person
WHERE
LastName
=
'Duffy'
;

Fair warning though, I’m pretty sure this is going to be a typical response if you ask for a code review on this type of thing:

In case you are wondering, the lesson you should have learned from this is not “I can write even more obnoxious looking queries now”. What you should learn is that if you have an idea for something that might work, it’s worth trying it out and finding out for yourself.

Filed under: Microsoft SQL Server, SQLServerPedia Syndication, T-SQL Tagged: microsoft sql server, T-SQL

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating