|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Monday, March 18, 2013 10:40 AM
Points: 249,
Visits: 964
|
|
SELECT*FROM[sysobjects]ORDER BY 1desc
or even
EXEC('SELECT*FROM[sysobjects]ORDERBY1desc')
welcome to SQL golfing - omg LOL
The second thing is especialy bad, play with the order by to see why
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Friday, November 30, 2012 1:52 AM
Points: 1,116,
Visits: 602
|
|
Carlo Romagnano (5/28/2010)
Try this: select*from sysobjects order by 1desc No space in 1desc I've seen that too before, same like this: declare @a int set @a=1select @a However, select1 or select@a won't work. It seems that a keyword preceded by an integer always works. I would definitely avoid using it though, it only confuses me.
Ronald Hensbergen
Help us, help yourself... Post data so we can read and use it: http://www.sqlservercentral.com/articles/Best+Practices/61537/ ------------------------------------------------------------------------- 2+2=5 for significant large values of 2
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Friday, May 17, 2013 2:04 AM
Points: 1,968,
Visits: 1,819
|
|
[quote]
EXEC('SELECT*FROM[sysobjects]ORDERBY1desc')
In this case the "order by" clause is missing ORDERBY1desc is the alias of [sysobjects]
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Friday, May 17, 2013 2:53 AM
Points: 1,527,
Visits: 359
|
|
I've seen that too before, same like this: declare @a int set @a=1select @a However, select1 or select@a won't work. It seems that a keyword preceded by an integer always works. I would definitely avoid using it though, it only confuses me.
agreed, it just increases confusion.
However was wondering, when SSMS executes the query, it would have to do some effort to remove spaces between the words
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Yesterday @ 12:59 AM
Points: 3,188,
Visits: 4,141
|
|
ziangij (5/28/2010)
However was wondering, when SSMS executes the query, it would have to do some effort to remove spaces between the words  SSMS itself does not execute queries because it is a client application. SSMS divides input text into batches, sequentially sends those batches to SQL Server, and displays received results. No spaces are added or removed while sending batches to the server. You can use SQL Server Profiler to see it.
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Friday, May 17, 2013 11:53 AM
Points: 2,672,
Visits: 2,416
|
|
| They may all work, but they are all a crime against readability. I make a point of white space for readability just about everywhere.
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Thursday, July 22, 2010 8:59 AM
Points: 110,
Visits: 952
|
|
"A crime against readability" I'll reuse that quote soon enough.
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Friday, February 04, 2011 7:20 AM
Points: 977,
Visits: 1,499
|
|
I'm afraid I have to join the chorus in saying the question was poorly worded.
Interesting info though.
Tom Garth Vertical Solutions
"There are three kinds of men. The one that learns by reading. The few who learn by observation. The rest of them have to pee on the electric fence for themselves." -- Will Rogers
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Yesterday @ 2:37 PM
Points: 315,
Visits: 1,353
|
|
malleswarareddy_m (5/27/2010) I did not understand this question.in question it shows that to select wrong sytax.but all resturns table data without any error.then i did not found the wrong answer.so i applied three answers.got my point.
He did say "select all that apply"
So 1st you have to select all the statements that are correct, then guess the error statements?
The part about guessing the error messages, if there are any, are for extra credit
Ken
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, May 09, 2013 4:26 AM
Points: 1,
Visits: 20
|
|
|
|
|