sp_clearstats

Description

Initiates a new accounting period for all server users or for a specified user. Prints statistics for the previous period by executing sp_reportstats.

Syntax

sp_clearstats [loginame]

Parameters

loginame

is the user’s login name.

Examples

Example 1

Initiates a new accounting period for all users.

sp_clearstats

Name    Since           CPU  Percent CPU     I/O    Percent I/O 
------  --------     ------  ----------- -------    ------------- 
probe   Jun 19 1990       0           0%       0         0% 
julie   Jun 19 1990   10000     24.9962%    5000         24.325% 
jason   Jun 19 1990   10002     25.0013%    5321         25.8866% 
ken     Jun 19 1990   10001     24.9987%    5123         24.9234%
kathy   Jun 19 1990   10003     25.0038%    5111         24.865% 
(5 rows affected) 
Total CPU   Total I/O 
---------      --------- 
40006       20555 
5 login accounts cleared.

Example 2

Initiates a new accounting period for the user “kathy.”

sp_clearstats kathy

Name  Since         CPU     Percent CPU     I/O     Percent I/O 
----- -----------   -----   ------------    -----   ----------- 
KATHY Jul 24 1990   498     49.8998%        483924  9.1829% 
(1 row affected)
Total CPU   Total I/O 
---------   ---------- 
998         98392 
1 login account cleared.

Usage

Permissions

Only a System Administrator can execute sp_clearstats.

See also

System procedures sp_reportstats