Follow SQLMaster on Twitter
Welcome to SqlServer-QA.net Sign in | Help

Fun with GO

In this blog post, I explained different uses of GO command

Here is a Fun when you use GO as object name

CREATE PROCEDURE GO
(
    @I INT
)
AS
    SELECT @I AS number

Well. The procedure is created and let us try to execute

GO 2

What we see is

Command
(s) completed successfully

Becuase it becomes a syntax to execute a batch for two times

EXECUTE GO 2

Result is 2

Now see what the results are for the following

Execution 1
[GO] 2

Execution 2
[GO] 2
GO 2

Execution 3
[GO] 2
GO
EXECUTE GO 2
GO

Execution 4
[GO] 2
GO 2
GO 2

Execution 5
[GO] 2
GO
GO

Execution 6
EXECUTE GO 2
EXECUTE GO 2
GO 2

Execution 7
[GO] 2
GO
GO 2
GO 2
EXECUTE GO 2
GO
GO 2
GO 2
GO 2

Execution 8
GO;

Execution 9
GO;2

Execution 10
GO 2;

Published Friday, September 05, 2008 8:58 AM by Madhivanan
Filed under: , ,

Comments

# Fun with GO

In this blog post , I explained different uses of GO command Here is a Fun when you use GO as object

Friday, September 05, 2008 4:58 AM by Other SQL Server Blogs around the Web

# SQL Server Transact-SQL (SSQA.net) : Fun with GO

Friday, September 05, 2008 5:07 AM by SQL Server Transact-SQL (SSQA.net) : Fun with GO

# Log Buffer #114: A Carnival of the Vanities for DBAs

Friday, September 12, 2008 11:23 AM by Log Buffer #114: A Carnival of the Vanities for DBAs
Anonymous comments are disabled