Are BEGIN / END keywords required in a stored procedure? [duplicate] Are BEGIN / END keywords required in a stored procedure? [duplicate] sql sql

Are BEGIN / END keywords required in a stored procedure? [duplicate]


They are optional.

From MSDN - CREATE PROCEDURE:

From the definition of the command -

AS { [ BEGIN ] sql_statement [;] [ ...n ] [ END ] }

And later on in the page:

{ [ BEGIN ] sql_statement [;] [ ...n ] [ END ] }

One or more Transact-SQL statements comprising the body of the procedure. You can use the optional BEGIN and END keywords to enclose the statements.


As indicated in the CREATE PROCEDURE documentation, they are optional.

{ [ BEGIN ] sql_statement [;] [ ...n ] [ END ] }

One or more Transact-SQL statements comprising the body of the procedure. You can use the optional [emphasis added] BEGIN and END keywords to enclose the statements. For information, see the Best Practices, General Remarks, and Limitations and Restrictions sections that follow.

Personally, I always include them, but that's just me.