SA0218 : The ‘::’ function calling syntax is deprecated

The topic describes the SA0218 analysis rule.

Message

The ‘::’ function calling syntax is deprecated

Description

The rule checks T-SQL code and reports usages of the deprecated built-in function calling syntax ‘::’.

The calling of system function using the ::funciton_name() syntax is now deprecated and can be replaced with sys.function_name().

How to fix

Replace the calls to system functions using the deprecated `::funciton_name()` syntax with `sys.function_name()`.

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

Deprecated Features, Bugs

Additional Information
Example Test SQL
SQL
1-- Deprecated syntax usage.
2SELECT * FROM ::fn_virtualfilestats(2,1) 
3
4-- Correct function call syntax.
5SELECT * FROM sys.fn_virtualfilestats(2,1)

Analysis Results
  Message Line Column
1 SA0218 : The ‘::’ function calling syntax is deprecated. 2 16
See Also

Other Resources