Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Improve script to include database size?

Author  Topic 

DeepGround
Yak Posting Veteran

73 Posts

Posted - 2009-07-02 : 13:06:56
Hello!

I have a simple script:

exec sp_msforeachdb "print '?'"

which lists the name of each database followed by a carridge return.
Does anyone know a way I could add the database size to the output for example:

master 21MB
tempdb 3489MB
Clients 489689MB
etc etc

mcrowley
Aged Yak Warrior

771 Posts

Posted - 2009-07-02 : 13:37:08
[code]select db_name(dbid), sum(size)/128 as "Size in MB"
from master..sysaltfiles
group by dbid[/code]
Go to Top of Page

DeepGround
Yak Posting Veteran

73 Posts

Posted - 2009-07-02 : 13:39:11
WoW! And it is so efficient!! Thank you
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-02 : 13:42:49
sp_databases
Go to Top of Page
   

- Advertisement -