Click or drag to resize

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

New Rules, Deprecated Features

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

 MessageLineColumn
1SA0219 : A deprecated build-in function FILE_ID is used.17
2SA0219 : A deprecated build-in function INDEXKEY_PROPERTY is used.44
3SA0219 : A deprecated build-in function INDEXKEY_PROPERTY is used.64
4SA0219 : A deprecated build-in function USER_ID is used.97
See Also

Other Resources