SA0219 : A deprecated build-in function is used

The topic describes the SA0219 analysis rule.

Message

A deprecated build-in function is used

Description

The rule checks for usages of deprecated built-in functions.

The FILE_ID,INDEXKEY_PROPERTY,USER_ID,DATABASEPROPERTY and PERMISSIONS built-in functions are in maintenance mode and may be removed in a future version of Microsoft SQL Server. Avoid using these functions in new development work, and plan to modify applications that currently use them.

Check the documentation for available alternative for the specific 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.

Categories

Deprecated Features, Bugs

Additional Information
Example Test Script
SQL
1SELECT FILE_ID('AdventureWorks2012_Data')AS 'File ID';  
2
3SELECT   
4    INDEXKEY_PROPERTY(OBJECT_ID('Production.Location', 'U'),  
5        1,1,'ColumnId') AS [Column ID],  
6    INDEXKEY_PROPERTY(OBJECT_ID('Production.Location', 'U'),  
7        1,1,'IsDescending') AS [Asc or Desc order];  
8
9SELECT USER_ID('Harold');

Analysis Results

  Message Line Column
1 SA0219 : A deprecated build-in function FILE_ID is used. 1 7
2 SA0219 : A deprecated build-in function INDEXKEY_PROPERTY is used. 4 4
3 SA0219 : A deprecated build-in function INDEXKEY_PROPERTY is used. 6 4
4 SA0219 : A deprecated build-in function USER_ID is used. 9 7
See Also

Other Resources