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

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.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.