Wednesday, March 21, 2012

Scheduled report for database names and sizes

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"Nasir" <nmajeed@.prosrm.com> wrote in message
news:40056fa6$0$43848$39cecf19@.news.twtelecom.net. ..
> 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

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.

Simonsql

No comments:

Post a Comment