Solved

Go statement in SQl server stored procedures

Posted on 2004-10-13
4
259 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
4 Comments
 
LVL 26

Accepted Solution

by:
Hilaire earned 50 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

810 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