DF216: User defined-function name begins with ‘fn_’.
Last modified: December 25, 2024
The topic describes the DF216 T-SQL code analysis rule.
Category
NAMING CONVENTIONS
Message
User defined-function name begins with ‘fn_’.
Description
It is recommended to avoid using the ‘fn_’ prefix for user-defined function names, as this prefix is commonly reserved for system functions.
Noncompliant code example
CREATE FUNCTION dbo.fn_DemoFunction(@x INT)
RETURNS INT
AS
BEGIN
RETURN @x + @x
END
GO
Compliant solution
CREATE FUNCTION dbo.udf_DemoFunction(@x INT)
RETURNS INT
AS
BEGIN
RETURN @x + @x
END
GO
Was this page helpful?