Export (0) Print
Expand All
Expand Minimize

sp_updatestats

SQL Server 2000

Runs UPDATE STATISTICS against all user-defined tables in the current database.

Syntax

sp_updatestats [[@resample =] 'resample']

Return Code Values

0 (success) or 1 (failure)

Arguments

[@resample=] 'resample'

Specifies that sp_updatestats will use the RESAMPLE option of the UPDATE STATISTICS command. New statistics will inherit the sampling ratio from the old statistics. If 'resample' is not specified, sp_updatestats updates statistics using the default sampling. This parameter is varchar(8) with a default value of 'NO'.

Remarks

sp_updatestats displays messages indicating its progress. When the update is completed, it reports that statistics have been updated for all tables.

Permissions

Only the DBO and members of the sysadmin fixed server role can execute this procedure.

Examples

This example updates the statistics for tables in the pubs database.

USE pubs
EXEC sp_updatestats 

See Also

CREATE INDEX

CREATE STATISTICS

DBCC SHOW_STATISTICS

DROP STATISTICS

sp_autostats

sp_createstats

sp_dboption

System Stored Procedures

UPDATE STATISTICS

Show:
© 2014 Microsoft