sp_helpstats (Transact-SQL)
Restituisce informazioni statistiche sulle colonne e gli indici della tabella specificata.
Importante
|
|---|
|
Questa caratteristica verrà rimossa a partire dalla prossima versione di Microsoft SQL Server. Evitare di utilizzare questa funzionalità in un nuovo progetto di sviluppo e prevedere interventi di modifica nelle applicazioni in cui è attualmente implementata. Per ottenere informazioni sulle statistiche, eseguire una query sulle viste del catalogo sys.stats e sys.stats_columns. |
Utilizzare DBCC SHOW_STATISTICS per visualizzare informazioni statistiche dettagliate su indici o statistiche specifici. Per ulteriori informazioni, vedere DBCC SHOW_STATISTICS (Transact-SQL) e sp_helpindex (Transact-SQL).
Nell'esempio seguente vengono create statistiche a colonna singola per tutte le colonne appropriate di tutte le tabelle utente nel database AdventureWorks eseguendo la stored procedure sp_createstats. Viene poi eseguita la stored procedure sp_helpstats per recuperare le statistiche risultanti create nella tabella Customer.
USE AdventureWorks; GO EXEC sp_createstats; GO EXEC sp_helpstats @objname = 'Sales.Customer', @results = 'ALL'
Set di risultati:
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

Importante