DF045: The DBCC command is used.

Last modified: May 28, 2025

The topic describes the DF045 T-SQL code analysis rule.

Category

DEPRECATED

Message

The DBCC command is used.

Description

The DBCC commands are deprecated. Use actual alternatives instead.

Additional information

The rule checks for the following commands:

  • INDEXDEFRAG: Use the REBUILD option of ALTER INDEX instead.
  • DBREINDEX: Rewrite the statement to use the REBUILD option of ALTER INDEX.
  • CONCURRENCYVIOLATION: It no longer exists in SQL Server.
  • SHOWCONTIG: Query sys.dm_db_index_physical_stats to get this information.
  • OUTPUTBUFFER: It may require administrative privileges.

Noncompliant code example

DBCC DBREINDEX ('HumanResources.Employee', ' ', 70);
GO

Compliant solution

ALTER INDEX all ON HumanResources.Employee REBUILD
GO