SA0014 : Avoid ‘fn_’ prefix when naming functions

The topic describes the SA0014 analysis rule.

Message

Avoid ‘fn_’ prefix when naming functions

Description

This rule checks for user defined scalar functions with ‘fn_’.

Though this practice is supported, it is recommended that the prefixes not be used to avoid name clashes with Microsoft shipped objects.

How to fix

Do not use the ‘fn_’ prefix when naming the function.

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
2 minutes per issue.
Categories

Naming Rules, Bugs

Additional Information

There is no additional info for this rule.

Example Test SQL
SQL
 1CREATE FUNCTION dbo.fn_myfunction
 2(   
 3     @value AS int
 4)
 5RETURNS int
 6WITH EXECUTE AS  CALLER
 7AS 
 8 BEGIN
 9    SET @value=@value + 1
10END;

Analysis Results
  Message Line Column
1 SA0014 : Avoid ‘fn_’ prefix when naming functions. 1 20
See Also

Other Resources