Retrieving Table Size in SQL Server 2008

In this article I will explain, how to get table size in SQL.
  • 1701

Introduction

In this article, I will explain how to get the actual data table size in SQL Server-2008. To do this we need to use a system stored procedure named "sp_spaceused".

Syntax

sp_spaceused  'Table_Name'

where,

sp_spaceused displays the number of rows, disc space reserved.
Table_Name specifies the table name whose space is to be displayed.

Example

1. To get the table size of table named "Employee".

Retreive-TableSize-In SQL.jpg

Rows- Number of rows existing in the table.
Reserved- Total amount of reserved space for Table.
Unused- Total amount of space reserved for table but not used.
Index_Size- Total space used by indexes in table.

2. To get the size of each table in the specified database.

Retreive-TableSize-of-ALLTable-In SQL.jpg

© 2013 dotNetheaven. All rights reserved.