Solved

Go statement in SQl server stored procedures

Posted on 2004-10-13
4
260 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

791 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