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
 General SQL Server Forums
 New to SQL Server Programming
 Trying to get the size of all DB's on a server

Author  Topic 

Eric_H
Starting Member

1 Post

Posted - 2010-06-10 : 19:18:25

Hello,

After a bit of googling, I found a way to get the size of a db by using sp_spaceused. However, the procedure returns two result sets, is it possible to combine them into a single row somehow?

The ideal end result is being able to get a result set that has Database name, Current Size, and unallocated space for every DB on the server.

Thanks for any help.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-06-10 : 19:29:49
You can't do it with T-SQL, but you can do it with .NET as you can put it into a Data Set with two Data Tables.

You may find my database size tool interesting, but it only records the file sizes: http://weblogs.sqlteam.com/tarad/archive/2008/12/16/How-to-track-database-growth-across-multiple-SQL-Server-instances.aspx

It was featured in a SQL Server Magazine online article: http://weblogs.sqlteam.com/tarad/archive/2009/10/08/SQL-Server-Magazine-web-article-about-a-tool-I-wrote.aspx

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -