Megosztás a következőn keresztül:


DROP STATISTICS (Transact-SQL)

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

Topic link iconTransact-SQL Syntax Conventions

Syntax

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

Arguments

  • table | view
    Is the name of the target table or indexed view for which statistics should be dropped. Table and view names must comply with the rules for Identifiers. Specifying the table or view owner name is optional.

  • statistics_name
    Is the name of the statistics group to drop. Statistics names must comply with the rules for identifiers

Remarks

Be careful when you drop statistics. Doing so may affect the execution plan chosen by the query optimizer.

Statistics on indexes cannot be dropped by using DROP STATISTICS. Statistics remain as long as the index exists.

For more information about displaying statistics, see DBCC SHOW_STATISTICS (Transact-SQL).

Permissions

Requires ALTER permission on the table or view.

Examples

The following example drops the statistics groups (collections) of two tables. The VendorCredit statistics group (collection) of the Vendor table and the CustomerTotal statistics (collection) of the SalesOrderHeader table are dropped.

-- Create the statistics groups.
USE AdventureWorks2008R2;
GO
CREATE STATISTICS VendorCredit
    ON Purchasing.Vendor (Name, CreditRating)
    WITH SAMPLE 50 PERCENT
CREATE STATISTICS CustomerTotal
    ON Sales.SalesOrderHeader (CustomerID, TotalDue)
    WITH FULLSCAN;
GO
DROP STATISTICS Purchasing.Vendor.VendorCredit, Sales.SalesOrderHeader.CustomerTotal;