Click or drag to resize

EX0009 : Consider adding proper comment block before each database object create statement

The topic describes the EX0009 analysis rule.

Message

Consider adding proper comment block before each database object create statement

Description

The rule checks the T-SQL script for missing or incomplete header block above the procedures, triggers, views and functions creation statements.

The rule parameters provide standard regular expression templates for matching the specific comment block elements (Author, Create Date and etc.).

Scope

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

Parameters
NameDescriptionDefault Value
AuthorLineTemplate

Regular expression to match the Author line in the header block.

Author\s*:\s*\w+

CreatedDateLineTemplate

Regular expression to match the Create Date line in the header block.

Create Date\s*:.

UpdatedDateLineTemplate

Regular expression to match the Update Date line in the header block.

Update Date\s*:.

UpdatedByLineTemplate

Regular expression to match the Update By line in the header block.

Update By\s*:\s*\w+

DescriptionLiteTemplate

Regular expression to match the Description line in the header block.

Description\s*:.

Remarks

The rule does not need Analysis Context or SQL Connection.

Categories

Explicit Rules

Additional Information

There is no additional info for this rule.

Example Test Script
 1-- =============================================
 2-- Author:                Author's name
 3-- Create Date: 2010-05-01
 4-- Description:        Example Stored Procedure
 5-- Update Date:        2010-05-19
 6-- =============================================
 7CREATE PROCEDURE MyProcedureName 
 8
 9
10        @p1 int = 0, 
11        @p2 int = 0
12AS
13BEGIN
14        -- SET NOCOUNT ON added to prevent extra result sets from
15        -- interfering with SELECT statements.
16        SET NOCOUNT ON;
17
18    -- Insert statements for procedure here
19        SELECT 1, @p2
20END

Analysis Results

 MessageLineColumn
1EX0009 : The create statement for procedure [MyProcedureName] is missing Update By line in its header.10
See Also

Other Resources