Groups | Blog | Home
all groups > sql server (alternate) > january 2004 >

sql server (alternate) : Scheduled report for database names and sizes


Nasir
1/14/2004 10:34:46 AM
Does anyone has a script which gives all databases names and there
allocated, used sizes in SQLserver2k. I want to schedule this to create a
daily report.

Thanks,
Nasir

Simon Hayes
1/14/2004 8:04:42 PM

[quoted text, click to view]

Depending on what you need, this may be good enough:

exec sp_MSforeachdb 'exec sp_helpdb ?'
and/or
exec sp_MSforeachdb 'exec ?..sp_spaceused'

Note that this will return multiple result sets, which are awkward to
process within SQL Server itself, although it should be straightforward in a
client script. sp_MSforeachdb is not documented, but you can use your own
cursor instead for production.

Simon

AddThis Social Bookmark Button