DROP STATISTICS (T-SQL)

Drops statistics for multiple collections within the specified tables (in the current database).

Syntax

DROP STATISTICS table.statistics_name [,...n]

Arguments
table
Is the name of the target table for which statistics should be dropped. Table names must conform to the rules for identifiers. For more information, see Using Identifiers. Specifying the table owner name is optional.
statistics_name
Is the name of the statistics group to drop. Statistics names must conform to the rules for identifiers.
n
Is a placeholder indicating that more than one statistics_name group (collection) can be specified.
Remarks

Be careful when dropping statistics because dropping statistics may affect the plan chosen by the optimizer.

For information about displaying statistics, see DBCC SHOW_STATISTICS. For information about updating statistics, see UPDATE STATISTICS and the auto update statistics option of sp_dboption. For information about creating statistics, see CREATE STATISTICS, CREATE INDEX, and the auto create statistics option of sp_dboption.

Permissions

DROP STATISTICS permission defaults to the table owner, and is not transferable. However, members of the db_owner fixed database role or sysadmin fixed server role can drop any object by specifying the owner in DROP STATISTICS.

Examples

This example drops the anames statistics group (collection) of the authors table and the tnames statistics (collection) of the titles table.

-- Create the statistics groups.

CREATE STATISTICS anames

    ON authors (au_lname, au_fname)

    WITH SAMPLE 50 PERCENT
GO

CREATE STATISTICS tnames

    ON titles (title_id)

    WITH FULLSCAN

GO

DROP STATISTICS authors.anames, titles.tnames

GO

  

See Also
CREATE INDEX sp_createstats
CREATE STATISTICS sp_dboption
DBCC SHOW_STATISTICS UPDATE STATISTICS
sp_autostats USE

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.