May 20, 2009 at 11:56 am
Yep. I also just figured out. Works also in combination with TOP. It is the parser tolerance to allow missing spaces between numbers and aliases:
SELECT TOP 100N FROM Tally
That's also the reason why this works:
SELECT TOP(10) N FROM Tally t1
... And this doesn't:
SELECT TOP(10) N FROM Tally 1t
May 20, 2009 at 11:57 am
Examples:
select 1.AColumn :
AColumn
---------
1
select 1.0AColumn :
AColumn
---------
1.0
Now do those with a space before AColumn, you will get the same results.
May 20, 2009 at 12:56 pm
Wild. I've never seen that before. Cool. Good job figuring it out. I can sleep tonight now. Thanks.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
May 20, 2009 at 1:06 pm
By the way, with a little more experimentation, this also works:
SELECT 'dude'dudette
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
May 20, 2009 at 1:59 pm
Be careful - you might be surprised when you use something like:
SELECT 1.Email, 2.Everything, 3.Else
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
May 20, 2009 at 6:24 pm
Ooooh. Cool. I like that one. You could really mess with people's heads with this.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
May 20, 2009 at 6:42 pm
Too Cool!!
I agree, great way to mess with someones head.
May 20, 2009 at 8:39 pm
Yeah - it is kinda cool 😎
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
May 20, 2009 at 9:17 pm
May 20, 2009 at 10:36 pm
This has all the earmarks of an ancient SQL parsing rule. I bet this one goes waaay back. Can someone try it on SQL 2000?
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
May 21, 2009 at 12:23 am
I don't have the old QM anymore, but in my SQL2005 SSMS connected to a SQL2000 engine gives the same behavior, including the interpretation of "E"xponent notation. Interesting stuff -- it depends on some of those "why'd they do that?" rules, like column names cannot start with a digit.
Now, who's going to be first to post something based on this as a QOD? Select 1.4TheMoney,3*8TheShow,3.2'GetReady',2+2ToGo,'Five''Six'PickupStix
May 21, 2009 at 5:39 am
Yeah. It works on 2000 too. I wish I had a 7.0 or, better still, a 6.5 system to try it out on.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
May 21, 2009 at 7:49 am
Now that's taking white space insensitive just a little too far.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
May 21, 2009 at 7:58 am
john.arnott (5/21/2009)
I don't have the old QM anymore, but in my SQL2005 SSMS connected to a SQL2000 engine gives the same behavior, including the interpretation of "E"xponent notation. Interesting stuff -- it depends on some of those "why'd they do that?" rules, like column names cannot start with a digit.Now, who's going to be first to post something based on this as a QOD?
Select 1.4TheMoney,3*8TheShow,3.2'GetReady',2+2ToGo,'Five''Six'PickupStix
Go for it. Looks like you already have the question.
May 22, 2009 at 4:38 pm
I tried the following on SQL 7.0, without a space before the 'from', so this does go back aways.
set nocount on
create table #cdarea (
cd int not null,
descr varchar(30) not null)
insert #cdarea values (0,'zero')
insert #cdarea values (2,'Area 2')
select cd,2from #cdarea
drop table #cdarea
-----------------------
cd
----------- -----------
0 2
2 2
Viewing 15 posts - 16 through 30 (of 43 total)
You must be logged in to reply to this topic. Login to reply