[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Go statement in SQl server stored procedures

Posted on 2004-10-13
4
Medium Priority
?
269 Views
Last Modified: 2012-05-05
Stored procedure written in sql server 2000 and called from vb6 program.

What is the difference between stored procedure that contains GO as the last statement & the one that is written without GO statement?

Does that mean : if I call 1st stored procedure through my application that doesn't have GO at the end & then call 2nd stored procedure that doesn't have GO either & call the 3rd stored procedure that has GO statement at the end. Will it work as a transaction? I mean if an error occured in 2nd stored procedure ... then will the results of 1st stored procedure be also rolled back b'cos there was no GO statement in first two procedures?

0
Comment
Question by:hello_2004
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 26

Accepted Solution

by:
Hilaire earned 200 total points
ID: 12297907
You CAN'T have a GO statement inside a stored procedure

the GO at the end of a create statement is just for SQL Server to know that the procedure ends here,
and separate the "create procedure " statements from one another when you have several in the same script.

create proc sp_dummy  as
select 1
go

-- display sp code --> you won't see any go
sp_helptext sp_dummy

drop proc sp_dummy
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question