The
GO n
Option
The GO command is not really a T-SQL command; it’s actually a command used by SQL Server’s client
tools, such as SSMS, to denote the end of a batch. This command supports an argument indicating
how many times you want to execute the batch. To see how the GO command with the argument
works, first create the table T1 by using the following code.
IF OBJECT_ID('dbo.T1', 'U') IS NOT NULL DROP TABLE dbo.T1;
CREATE TABLE dbo.T1(col1 INT IDENTITY);
The col1 column gets its values automatically from an identity property. Note that the demo would
work just as well if you used a default constraint to generate values from a sequence object. Next, run
the following code to suppress the default output produced by DML statements that indicates how
many rows were affected.
SET NOCOUNT ON;
www.it-ebooks.info
Do'stlaringiz bilan baham: |