sp_dbcc_deletehistory

Description

Deletes the results of dbcc checkstorage operations performed on the target database before the specified date and time.

Notesp_dbcc_deletehistory does not free any space associated with the deleted historical data, as workspaces are pre-allocated and of a fixed size.

Syntax

sp_dbcc_deletehistory [cutoffdate [, dbname | dbid]]

Parameters

cutoffdate

deletes all entries made on or before this date. This parameter is of type datetime. If a date is not specified, only the results of the last operation are retained. For more information, see “Specifying the date”.

dbname

specifies the name of the database for which the data must be deleted. If not specified, sp_dbcc_deletehistory deletes the history information for all databases in dbccdb..dbcc_config.

dbid

specifies the database ID number of the target database for which you want the history information deleted.

Examples

Example 1

Deletes results of all operations performed on the database pubs2 on or before March 4, 1997:

sp_dbcc_deletehistory "03/04/1997", "pubs2"

Usage

Permissions

The permission checks for sp_dbcc_deletehistory differ based on your granular permissions settings.

Granular permissions enabled

With granular permissions enabled, you must be the database owner of dbccdb (or dbccalt), or have the manage checkstorage privilege on the specified database.

Granular permissions disabled

With granular permissions disabled, you must be the database owner of the specified database or a user with sa_role to run sp_dbcc_deletehistory on a specific database. Only a user with sa_role can run sp_dbcc_deletehistory without specifying a database name.

See also

See the System Administration Guide for information on the dbccalt database.

Commands dbcc

dbcc stored procedures sp_dbcc_deletedb, sp_dbcc_evaluatedb

System procedures sp_plan_dbccdb