How to find space used by table in SQL Server

  • Home
  • Blog
  • How to find space used by table in SQL Server

Recently there was requirement for a client where we need to find space occupied/used  by particular table in SQL Server. I did some research a found a very cool way to get space used information from SQL Server. With SQL server 2005 and higher version you can use ‘sp_spaceused’ to find space used by table in SQL Server. Following is a syntax for that.

sp_spaceused N’YourTableName’

You can find more information about it from the following link.

http://msdn.microsoft.com/en-us/library/ms188776.aspx

When you run this in SQL Server, Its displays Number of Rows, disk space served and disk space used by a table or indexed view and also displays disk space reserved and used by database.

Here in the above example, You have seen that I have used to find space for employee table in my blog sample database and its providing information about rows, reserved space, data size, index_size space and unused space.

That’s it. Hope you like it. Stay tuned for more.