sp_helpstats (Transact-SQL)
Returns statistics information about columns and indexes on the specified table.
Important |
|---|
This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. To obtain information about statistics, query the sys.stats and sys.stats_columns catalog views. |
Use DBCC SHOW_STATISTICS to display detailed statistics information about any particular index or statistics. For more information, see DBCC SHOW_STATISTICS (Transact-SQL) and sp_helpindex (Transact-SQL).
The following example creates single-column statistics for all eligible columns for all user tables in the AdventureWorks2008R2 database by executing sp_createstats. Then, sp_helpstats is run to find the statistics created on the Customer table.
USE AdventureWorks2008R2; GO EXEC sp_createstats; GO EXEC sp_helpstats @objname = 'Sales.Customer', @results = 'ALL'
Here is the result set.
statistics_name statistics_keys ---------------------------------------------------------------- _WA_Sys_00000002_2A4B4B5E PersonID _WA_Sys_00000003_2A4B4B5E StoreID _WA_Sys_00000005_2A4B4B5E AccountNumber AK_Customer_AccountNumber AccountNumber AK_Customer_rowguid rowguid CustomerType CustomerType IX_Customer_TerritoryID TerritoryID ModifiedDate ModifiedDate PK_Customer_CustomerID CustomerID

Important