dcsimg
LinkedIn
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: SQL
Expertise: Intermediate
Dec 22, 2016

The sp_MSforeachdb Stored Procedure

The sp_MSforeachdb stored procedure helps you to do repetitive actions against all or some of the SQL Server instance databases.

For example, this query:

EXEC sp_MSforeachdb 'USE [?]; EXEC sp_spaceused'

Displays the space used (Reserved space, Data, index Size, Unused Space) by each database.

Hannes du Preez
 
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date