Reputation: 29
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE <Procedure_Name, sysname, ProcedureName>
-- Add the parameters for the stored procedure here
<@Param1, sysname, @p1> <Datatype_For_Param1, , int> = <Default_Value_For_Param1, , 0>,
<@Param2, sysname, @p2> <Datatype_For_Param2, , int> = <Default_Value_For_Param2, , 0>
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT <@Param1, sysname, @p1>, <@Param2, sysname, @p2>
END
GO
Can anyone help me understand the syntax of SQL? I am new to this forum as well as in SQL Server. I would like to know about the GO command in stored procedure at the end of script. Thanks in advance.
Upvotes: 1
Views: 227
Reputation: 172448
See the MSDN:
Signals the end of a batch of Transact-SQL statements to the SQL Server utilities.
Also note that GO is not a TSQL statement.
SQL Server utilities interpret GO as a signal that they should send the current batch of Transact-SQL statements to an instance of SQL Server. The current batch of statements is composed of all statements entered since the last GO, or since the start of the ad hoc session or script if this is the first GO.
Its a batch seperator used in SQL Server Management Studio. You can go to Tools--> Options--> Query Execution
Upvotes: 1