Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What does the 'GO' command do???

Status
Not open for further replies.

rmahawaii

Programmer
Oct 21, 2002
29
HK
Hello All, I just want to know what does the 'GO' command do in a stored procedure? I noticed there is a difference when I put it in or when I left it out. It will usually cause compiler error when i put it in. Can anyone please let me know? Thanks in advance.
 
OSQL, ISQL and query analyzer all use it to signal the end of a batch. But it is not a TSQL command.

 
Like the other folks have replied, the GO ends a batch. But, you mentioned that it causes compiler error. That is not correct. It means that you have put GO in a wrong place. When a batch is marked by a GO, information such as a local variable will be limited only to that batch and if you refer to those in any other batch in the stored proc, then error will occur. I think this is the reason why you get compiler error.

SQLnerd
 
Thanks for all of your explanations folks. I now understand my problem clearly. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top