Q: How can I see the size of each table within my SQL Server database?

SSMS helps you see the table size in your SQL Server databases.

John Savill

January 3, 2012

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A: Open SQL Server Management Studio and expand Databases, then right-click the database you want to run queries for. Select New Query from the context menu, which opens a new query window.

You can use the built-in stored procedure sp_spaceused to find the space used for a database or table within a database. For example, if I just run the following:

EXEC sp_spaceused

it shows me the total size of my database. To see the size of a particular table I can pass the name of the table:

EXEC sp_spaceused 'Catalog'

To see a list of the sizes of all tables in the database I can combine sp_spaceused with the sp_MSforeachtable stored procedure to run the space used stored procedure for every table:

EXEC sp_MSforeachtable @command1="EXEC sp_spaceused '?'"

You can now see the size of every table in the database.

Get more help from John Savill on everything Microsoft--and more--at John Savill's FAQS for Windows.

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like