Click or drag to resize

SA0250 : Consider calling procedures with named arguments

The topic describes the SA0250 analysis rule.

Message

Consider calling procedures with named arguments

Description

The rule check T-SQL code for procedure calls using unnamed arguments.

It is recommended to specify the argument name when executing a stored procedure.

While it is entirely legal to use an ordered list of unnamed arguments, in case a new parameter is added in the middle of the parameters list, having a named arguments could prevent problems with the existing execute statements of the procedue.

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, New Rules

Additional Information

There is no additional info for this rule.

Example Test Script
SQL
 1DECLARE  @result INT
 2EXEC @result = uspGetWhereUsedProductID  819, '20050225';
 3EXEC uspGetWhereUsedProductID;1   123, @CheckDate = '20050225', @StartProductID = 819;
 4
 5EXEC uspGetWhereUsedProductID   @NoSuchParam = 123, @CheckDate = '20050225', @StartProductID = 819;
 6
 7EXECUTE  AdventureWorks2008R2_Test.dbo.uspGetWhereUsedProductID  @StartProductID = 819, @CheckDate = '20050225';
 8
 9
10EXEC @result = uspGetWhereUsedProductID  819, '20050225', 122;
11DECLARE @output int
12EXEC @result = uspGetWhereUsedProductID  819, @output output,'20050225', 1223 ;
13EXEC @result = uspGetWhereUsedProductID
14EXEC TestReturnPlanForEX0018_Encrypted_Numbered;3 123

Analysis Results

 MessageLineColumn
1SA0250 : Consider calling procedures with named arguments.215
2SA0250 : Consider calling procedures with named arguments.35
3SA0250 : Consider calling procedures with named arguments.1015
4SA0250 : Consider calling procedures with named arguments.1215
5SA0250 : Consider calling procedures with named arguments.145
See Also

Other Resources