Click or drag to resize

SA0078 : Statement is not terminated with semicolon

The topic describes the SA0078 analysis rule.

Message

Statement is not terminated with semicolon

Description

The rule checks for statements not terminated with semicolon.

Consider terminating all statements with semicolon to improve readability and compatibility with future versions of SQL Server.

As more and more keywords, and statements are added to Transact-SQL, there will appear more cases where the semicolon terminator will be required.

Scope

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

Parameters

Rule has no parameters.

Remarks

The rule does not need Analysis Context or SQL Connection.

Categories

Design Rules

Additional Information

There is no additional info for this rule.

Example Test Script
 1-- Create procedure to retrieve error information.
 2CREATE PROCEDURE usp_GetErrorInfo
 3AS 
 4BEGIN   
 5    BEGIN TRY
 6    -- Generate divide-by-zero error.
 7
 8        SELECT  1 / 0  
 9    END TRY 
10            BEGIN CATCH 
11    -- Execute error retrieval routine. 
12
13        EXECUTE usp_GetErrorInfo -- gets error info
14    END CATCH;
15
16    BEGIN TRANSACTION;
17
18    IF @@TRANCOUNT = 0 
19    BEGIN 
20        ROLLBACK TRANSACTION 
21
22        PRINT N'Rolling back the transaction two times would cause an error.' 
23    END
24
25END

Analysis Results

 MessageLineColumn
1SA0078 : Statement is not terminated with semicolon.253
2SA0078 : Statement is not terminated with semicolon.821
3SA0078 : Statement is not terminated with semicolon.1332
4SA0078 : Statement is not terminated with semicolon.237
5SA0078 : Statement is not terminated with semicolon.2028
6SA0078 : Statement is not terminated with semicolon.2277
See Also

Other Resources