SA0213 : The DBCC command is deprecated

The topic describes the SA0213 analysis rule.

Message

The DBCC command is deprecated

Description

The rule checks T-SQL code for usages of deprecated DBCC commands.

The deprecated DBCC commands are the following:

– DBCC DBREINDEX

– DBCC INDEXDEFRAG

– DBCC SHOWCONTIG

– DBCC PINTABLE

– DBCC UNPINTABLE

How to fix

Do not use the deprecated DBCC commands. Check for alternatives in the documentation of the specific command.

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

Deprecated Features, Bugs

Additional Information
Example Test SQL
SQL
1DBCC DBREINDEX ('HumanResources.Employee', PK_Employee_BusinessEntityID,80);  
2DBCC DBREINDEX ('HumanResources.Employee', ' ', 70);  
3DBCC INDEXDEFRAG (AdventureWorks2012, 'Production.Product', PK_Product_ProductID);  
4
5DBCC SHOWCONTIG ('HumanResources.Employee');  
6DBCC PINTABLE ( 12 , 12 )
7DBCC UNPINTABLE ( 12 , 33 )
8DBCC HELP ('CHECKDB')

Analysis Results
  Message Line Column
1 SA0213 : The DBCC DBREINDEX command is deprecated. Use ALTER INDEX instead. 1 5
2 SA0213 : The DBCC DBREINDEX command is deprecated. Use ALTER INDEX instead. 2 5
3 SA0213 : The DBCC INDEXDEFRAG command is deprecated. Use ALTER INDEX instead. 3 5
4 SA0213 : The DBCC SHOWCONTIG command is deprecated. Use sys.dm_db_index_physical_stats instead. 5 5
5 SA0213 : The DBCC PINTABLE command is deprecated. The command has no effect and its usages should be removed. 6 5
6 SA0213 : The DBCC UNPINTABLE command is deprecated. The command has no effect and its usages should be removed. 7 5
See Also

Other Resources