|
|
|
UDP Broadcaster
      
Group: General Forum Members
Last Login: Wednesday, April 17, 2013 10:57 PM
Points: 1,491,
Visits: 3,008
|
|
I thank David Dresser for a good job parsing this out. I tried making it slightly more coder-friendly by renaming the proc "JO" and the variable "KO". I then found that all but the first delimiter "Go" statements didn't seem to be needed at all. CREATE PROC JO @KO int=NULL AS SELECT @KO GO JO; GO 3 --GO EXECUTE('JO 3') GO 3 --GO DROP PROC JO --GO
|
|
|
|
|
UDP Broadcaster
      
Group: General Forum Members
Last Login: Wednesday, April 17, 2013 10:57 PM
Points: 1,491,
Visits: 3,008
|
|
Posts from Anders and webrunner point to how this script uses a new feature in SSMS not available in SQL 2000 QM. The Go 3 syntax to run something multiple times is not available in QM.
This raises a red flag about testing. The script works fine in SSMS against a SQL 2000 database. This implies that even in a SQL2005 db, it may not work from a program or in a stored procedure.
I've already burned a half-hour on this and have too much to do today, so will leave the resolution of that question to others.
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: Saturday, May 04, 2013 11:13 AM
Points: 9,855,
Visits: 9,374
|
|
john.arnott (8/25/2008) This raises a red flag about testing. The script works fine in SSMS against a SQL 2000 database. This implies that even in a SQL2005 db, it may not work from a program or in a stored procedure.
No it certainly will not. "GO" has always been a client interface feature. It does not work from a program or from a stored procedure and never has. Nor did the question imply that it would, it did specifically say "from SSMS".
-- RBarryYoung, (302)375-0451 blog: MovingSQL.com, Twitter: @RBarryYoung Proactive Performance Solutions, Inc. "Performance is our middle name."
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Monday, July 30, 2012 10:42 AM
Points: 3,434,
Visits: 519
|
|
GO should never be used as identifier. http://msdn.microsoft.com/en-us/library/ms189822.aspx Reserved Keywords (Transact-SQL)
This is not T-SQL keyword now but is on the list on ODBC keywords (second list in the referenced article) and on the third list of the future T-SQL keywords. This article says: "Although it is syntactically possible to use SQL Server reserved keywords as identifiers and object names in Transact-SQL scripts, you can do this only by using delimited identifiers." About Future Keywords the article says: "The following keywords could be reserved in future releases of SQL Server as new features are implemented. Consider avoiding the use of these words as identifiers."
Regards, Yelena Varshal
|
|
|
|
|
SSCarpal Tunnel
       
Group: General Forum Members
Last Login: Today @ 1:35 AM
Points: 4,787,
Visits: 1,336
|
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 10:01 AM
Points: 7,089,
Visits: 7,145
|
|
It threw me. I assumed SSMS would behave the same way as isqlw so gave the wrong answer. I'm inclined to consider the SMSS behaviour a bug, as making sense out of using "go" as an identifier is just making it easier to write obscure bugs - but in fact SQLS 2000 isqlw is just as bad as small adjustments to the script can demonstrate.
Tom Que conclure à la fin de tous mes longs propos? C'est que les préjugés sont la raison des sots. (Voltaire, 1756)
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 2:26 AM
Points: 1,060,
Visits: 4,172
|
|
That's what I like about QotD - the simplest questions are often the most thought provoking!
This definitely proves you should be careful what identifier names you choose.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Sunday, May 19, 2013 11:16 PM
Points: 1,061,
Visits: 1,151
|
|
gr888 question,, GO GO GO
|
|
|
|