Creating a Stored Procedure:IF OBJECT_ID('USP_Proc1','P') IS NOT NULL
DROP PROC USP_Proc1
GO
CREATE PROC USP_Proc1
AS
BEGIN
SELECT 'DotnetFunda' SQLServer
END
GOWhat is a Batch ?When we execute multiple statements as a whole, The whole statements called as a Batch.
Executing the following as a batch :USP_Proc1
USP_Proc1
Go
It will throw an Err: "Procedure USP_Proc1 has no parameters and arguments were supplied"
BOL Rules:If an EXECUTE statement is the first statement in a batch, the EXECUTE keyword is not required. The EXECUTE keyword is required if the EXECUTE statement is not the first statement in the batch.According to the BOL rule : In our batch, "EXEC" is not necessary for first line, It is mandatory on Second Line.
USP_Proc1
Exec USP_Proc1
Go
Result: SQLServer DotnetFunda
SQLServer DotnetFunda
Conclusion:BOL Rule: "If an EXECUTE statement is the first statement in a batch, the EXECUTE keyword is not required. The EXECUTE keyword is required if the EXECUTE statement is not the first statement in the batch."
Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions