Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12345»»»

T-SQL GO statement Expand / Collapse
Author
Message
Posted Monday, November 22, 2010 8:26 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: 2 days ago @ 1:14 PM
Points: 460, Visits: 492
Comments posted to this topic are about the item T-SQL GO statement
Post #1024816
Posted Tuesday, November 23, 2010 12:33 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, November 20, 2014 5:13 AM
Points: 1,131, Visits: 1,394
Nice command. Thanks

Thanks
Post #1024882
Posted Tuesday, November 23, 2010 1:14 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Monday, May 16, 2011 8:22 AM
Points: 378, Visits: 353
Ha! I never knew one could do that with GO.
Thanks!
Post #1024896
Posted Tuesday, November 23, 2010 1:20 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 7:49 AM
Points: 1,012, Visits: 1,007
Good point, thanks

Iulian
Post #1024901
Posted Tuesday, November 23, 2010 2:00 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 12:52 PM
Points: 13,636, Visits: 11,509
I like the point the question tried to make, namely using the GO statement as an instrument to loop, but I do not like the trickery with the # name. At first, I did not even notice the GO 100 statement, as I was focusing on the table name. So I'm confused what this question actually tried to do: teach us about GO n (mission accomplished), or about the various options for table names or was it just to trick people into choosing the wrong answer?



How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1024912
Posted Tuesday, November 23, 2010 2:12 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, September 18, 2014 7:22 AM
Points: 52, Visits: 84
Nice information, thanks..
Post #1024923
Posted Tuesday, November 23, 2010 2:25 AM


Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Wednesday, September 21, 2011 4:03 AM
Points: 713, Visits: 100
Good Question to ask !!!

--------------------------------------------------------------------------------
Mayank Parmar
Software Engineer

Clarion Technologies
SEI CMMI Level 3 Company

8th Floor, 803, GNFC info Tower,
SG Highway, Ahmedabad - 380 054,
Gujarat, India.
www.clariontechnologies.co.in

Email: mayank.parmar@clariontechnologies.co.in
MSN : mayank.parmar@clariontechnologies.co.in
Mobile: +91 9727748789
--------------------------------------------------------------------------------
Post #1024930
Posted Tuesday, November 23, 2010 3:18 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, August 27, 2013 4:28 AM
Points: 1,248, Visits: 779
da-zero (11/23/2010)
I like the point the question tried to make, namely using the GO statement as an instrument to loop, but I do not like the trickery with the # name. At first, I did not even notice the GO 100 statement, as I was focusing on the table name. So I'm confused what this question actually tried to do: teach us about GO n (mission accomplished), or about the various options for table names or was it just to trick people into choosing the wrong answer?



Yeah, I fell down on this one as well... however, when I did actually try to run the code it didn't seem to like the "100"... I got...

(1 row(s) affected)

Server: Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near '100'.


The code is identical... I'm running this on a SQL Server 2000 box, but I don't think that matters...


_____________________________________________________________________
"The difficult tasks we do immediately, the impossible takes a little longer"
Post #1024959
Posted Tuesday, November 23, 2010 3:31 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, November 20, 2014 5:13 AM
Points: 1,131, Visits: 1,394
Try
INSERT INTO # 
SELECT 'ASDF'
GO 0

GO <ZERO> --- SQL doesn't throw any complilation error but when you execute the code, status bar should display: "Query completed with errors".


Thanks
Post #1024967
Posted Tuesday, November 23, 2010 3:50 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Thursday, November 27, 2014 5:48 AM
Points: 969, Visits: 693
Good question, thanks for taking the time to help educate the SQL community.


Hope this helps,
Rich



Post #1024985
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse