Click or drag to resize

SA0185 : Review the call for unintentionally passing the same value more than once as an argument

The topic describes the SA0185 analysis rule.

Message

Review the call for unintentionally passing the same value more than once as an argument

Description

The rule checks SQL code for function or procedure calls for having the same values passed more than once as argument.

Review your code and suppress the rule violation if the code is correct and the duplicated arguments are intentional.

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
 1Test.Greeting 'message', 'message'
 2
 3declare @Message nvarchar(100) = 'hi'
 4declare @Name nvarchar(10) = 'George'
 5
 6exec Test.Greeting  @param1 = @Message, @param2 = @Message
 7exec Test.Greeting  @Message, @Message
 8exec Test.Greeting  @Name, @Message, @Name 
 9
10select isnull(message,message) from dbo.Greetings
11select isnull(message,'hello') from dbo.Greetings
12select isnull(@Name, @Message, @Name ) from dbo.Greetings
13select dbo.myFunction(name,name,message ) from dbo.Greetings
14
15
16select dbo.myFunction(1,2,10,1 ) from dbo.Greetings

Analysis Results

 MessageLineColumn
1SA0185 : Value appears more than once in the procedure arguments.114
2SA0185 : Value appears more than once in the procedure arguments.720
3SA0185 : Value appears more than once in the procedure arguments.820
4SA0185 : Value appears more than once in the function arguments.1014
5SA0185 : Value appears more than once in the function arguments.1214
6SA0185 : Value appears more than once in the function arguments.1322
7SA0185 : Value appears more than once in the function arguments.1622
See Also

Other Resources