When creating a stored procedure, does the BEGIN/END block serve and purpose?
eg,
CREATE PROCEDURE SPNAME
AS
SELECT * FROM TABLE
vs.
CREATE PROCEDURE SPNAME
AS
BEGIN
SELECT * FROM TABLE
END
As indicated in the CREATE PROCEDURE documentation, the BEGIN/END is optional:
{ [ 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. For information, see the Best Practices, General Remarks, and Limitations and Restrictions sections that follow.
As a matter of personal preference, I always include them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With