I have found some SP(stored procedure) written as,
CREATE PROCEDURE [dbo].[XXX]
(
-- Parameters
)
BEGIN
--- Actual Work
END
and some as
CREATE PROCEDURE [dbo].[XXX]
(
-- Parameters
)
--- Actual Work
What makes it difference?
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It only takes a minute to sign up.
Sign up to join this communityThere is no difference. That is, it's optional.
What matters is the "end of the batch" which is denoted in SQL Server Management Studio by GO
There is no real difference. Create procedure syntax specifies BEGIN
and END
as optional. And it makes sense since CREATE PROCEDURE
statement cannot be combined with other statements in a single batch.