SA0191 : Procedure body is not enclosed in BEGIN…END block |
![]() |
The topic describes the SA0191 analysis rule.

Procedure body is not enclosed in BEGIN…END block

The rule checks for CREAT/ALTER PROCEDURE statements and reports if the procedure body is not enclosed in a BEGIN..END block.

Enclose the procedure body explicitly in a `BEGIN..END` block.

The rule has a Batch scope and is applied only on the SQL script.

Rule has no parameters.

The rule does not need Analysis Context or SQL Connection.


Design Rules, Code Smells

There is no additional info for this rule.

SQL
1CREATE PROCEDURE HumanResources.uspGetAllEmployees 2AS 3SET NOCOUNT ON; 4 5SELECT LastName, FirstName, JobTitle, Department 6FROM HumanResources.vEmployeeDepartment; |

SQL
1CREATE PROCEDURE HumanResources.uspGetAllEmployees 2AS 3BEGIN 4 5SET NOCOUNT ON; 6 7SELECT LastName, FirstName, JobTitle, Department 8FROM HumanResources.vEmployeeDepartment; 9 10END |

Message | Line | Column | |
---|---|---|---|
1 | SA0191 : Procedure body is not enclosed in BEGIN…END block. | 1 | 0 |
