sp_helpstats (języka Transact-SQL)

Zwraca statystykę informacji na temat kolumn i indeksów w określonej tabela.

Important noteImportant Note:

This feature will be removed in the next version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Uzyskanie informacji na temat statystyk kwerendy sys.stats and sys.stats_columns widoki wykazu.

Topic link iconKonwencje składni języka Transact-SQL

sp_helpstats[ @objname = ] 'object_name' 
     [ , [ @results = ] 'value' ]

Argumenty

  • [ @objname=] 'object_name'
    Specifies the table on which to provide statistics information.object_name is nvarchar(520) and cannot be null.Można określić nazwy jednego lub dwóch części.

  • [ @results=] 'value'
    Określa fragment informacji, aby zapewnić.Prawidłowe wpisy są WSZYSTKIE and STATYSTYKA.ALL lists statistics for all indexes and also columns that have statistics created on them; STATS only lists statistics not associated with an index.value is nvarchar(5) with a default of STATS.

Wartości kodów powrotnych

0 (sukces) lub 1 (brak)

Zestawy wyników

W poniższej tabela opisano kolumny zestaw wyników.

Nazwa kolumna

Description

statistics_name

Nazwa statystyki.Zwraca wartość sysname i nie może mieć wartości null.

statistics_keys

Klucze, na których oparte są statystyki.Zwraca wartość nvarchar(2078) i nie może mieć wartości null.

Remarks

DBCC SHOW_STATISTICS służy do wyświetlania informacji szczegółowych statystyk dotyczących określonego indeksu ani statystyki.Aby uzyskać więcej informacji zobacz DBCC SHOW_STATISTICS (Transact-SQL) i sp_helpindex (Transact-SQL).

Uprawnienia

Członkostwo w grupie wymaga publiczne roli.

Przykłady

Poniższy przykład tworzy jedną kolumną statystykę dla wszystkich uprawnionych kolumn dla wszystkich tabel użytkownika w AdventureWorks bazy danych przez sp_createstats. Następnie, sp_helpstats jest uruchamiany do znalezienia wynikowy statystyki utworzone na Customer Tabela.

USE AdventureWorks;
GO
EXEC sp_createstats;
GO
EXEC sp_helpstats 
@objname = 'Sales.Customer',
@results = 'ALL'

Here is the result set.

statistics_name                  statistics_keys
----------------------------------------------------------------
_WA_Sys_00000003_22AA2996        AccountNumber
AK_Customer_AccountNumber        AccountNumber
AK_Customer_rowguid              rowguid
CustomerType                     CustomerType
IX_Customer_TerritoryID          TerritoryID
ModifiedDate                     ModifiedDate
PK_Customer_CustomerID           CustomerID