HiveBrain v1.2.0
Get Started
← Back to all entries
gotchasqlMinor

Difference Between SP with BEGIN/END and without BEGIN/END

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
withoutwithdifferencebetweenendandbegin

Problem

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?

Solution

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.

Context

StackExchange Database Administrators Q#44231, answer score: 5

Revisions (0)

No revisions yet.