Some time back, I had done an article on 6 Common Uses of the undocumented Stored Procedure sp_MSforeachdb
So now if you want to use this undocumented stored procedure to list the size of all databases in a SQL Server Instance, you would write the following query:
EXEC sp_MSforeachdb 'USE ?; EXEC sp_spaceused'
"IF '?' NOT IN ('master','tempdb', 'model') BEGIN
USE ?; EXEC sp_spaceused
This query will now list the size of all databases except the master, tempdb and model databases.
Did you like this post?
|subscribe via rss||subscribe via e-mail|
|print this post||follow me on twitter|