SA0260 : Parameter defined as nullable, but no default value provided

The topic describes the SA0260 analysis rule.

Message

Parameter defined as nullable, but no default value provided

Description

The rule checks T-SQL code for procedures and functions parameters, which are defined as null-able, but have no default value provided.

Even defined as null-able, such parameters, which don’t have a default value, will still require a value when the procedure or function is invoked.

How to fix

Provide default value to the null-able parameter.

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.

Effort To Fix
3 minutes per issue.
Categories

Design Rules, Bugs

Additional Information

There is no additional info for this rule.

Example Test SQL
SQL
 1CREATE PROCEDURE SA00256.TestProc
 2  @param1 int 
 3, @param2 int NULL
 4, @param3 int NULL = NULL
 5, @param4 int = NULL
 6AS
 7BEGIN
 8    SET NOCOUNT ON;
 9        /* PROCEDURE BODY */
10END

Analysis Results
  Message Line Column
1 SA0260 : Parameter defined as nullable, but no default value provided. 3 2
See Also

Other Resources