Click or drag to resize

SA0029 : Input parameter never used

The topic describes the SA0029 analysis rule.

Message

Input parameter never used

Description

This rule checks for not used stored procedure or function input parameters. Unused parameters not necessarily negatively affect the performance, but they just add bloat to your stored procedures and functions.

Scope

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

Parameters
NameDescriptionDefault Value
RuleSuppressMark

Suppress rule reporting a rule violation in case a comment containing the value of this parameter is found under the procedure or function parameter.

IGNORE:SA0029

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
 1CREATE PROCEDURE Production.uspGetList 
 2
 3      @Product varchar(40) 
 4        , @VendorCode varchar(20) -- parameter is not used
 5        , @VendorCode2 varchar(20) -- parameter is not used, but the rule is suppressed because this comment contains 'IGNORE:SA0029' text.
 6    , @MaxPrice money 
 7    , @ComparePrice money OUTPUT
 8    , @ListPrice money OUT
 9    , @input int -- parameter is only assigned, but not used
10AS
11    SET NOCOUNT ON;
12
13    SET @input = 0 
14    SELECT p.[Name] AS Product, p.ListPrice AS 'List Price'
15    FROM Production.Product AS p
16    JOIN Production.ProductSubcategory AS s 
17      ON p.ProductSubcategoryID = s.ProductSubcategoryID
18    WHERE s.[Name] LIKE @Product AND p.ListPrice < @MaxPrice;
19-- Populate the output variable @ListPprice.
20SET @ListPrice = (SELECT MAX(p.ListPrice)
21        FROM Production.Product AS p
22        JOIN  Production.ProductSubcategory AS s 
23          ON p.ProductSubcategoryID = s.ProductSubcategoryID
24        WHERE s.[Name] LIKE @Product AND p.ListPrice < @MaxPrice);
25-- Populate the output variable @compareprice.
26SET @ComparePrice = @MaxPrice;

Analysis Results

 MessageLineColumn
1SA0029 : The input parameter @VendorCode never used.43
2SA0029 : The input parameter @input never used.96
See Also

Other Resources