How to find the total tablespace usage in SQL Server 2008?

LittleLebowski picture LittleLebowski · Feb 24, 2012 · Viewed 16.5k times · Source

In SQL-server 2008, How would I find (through an SQL query), the percentage of tablespace usage for a particular instance(or all instances) of a SQL Server(2008 R2)?

Also, what is the best way (query) to get the list of all the Named Instances of a SQL Server?

Answer

Vikram picture Vikram · Feb 24, 2012

is this what you need:

EXEC sp_spaceused null, false

result:

database_name   database_size      unallocated space
--------------- ------------------ ------------------
DATABASE_NAME    220.25 MB          69.92 MB

reserved           data               index_size         unused
------------------ ------------------ ------------------ ------------------
110672 KB          80368 KB           26944 KB           3360 KB