Solved

Go statement in SQl server stored procedures

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

743 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now