Run on each database

To run a stored-procedure against every database in turn without a bunch of ‘USE dbname GO’ headers, use …

exec sp_msforeachdb 'use ? drop statistics alldocs.allDocs_level'

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s