Below is a SQL query to find table size in SQL Server. The calculation is based on SQL Query to find row size SQL Server blog (give the link of the said blog).

The above query creates a procedure sp_GetTableSize procedure. The procedure accepts a parameter @Tablename, the table to calculate the size for. Execute the procedure to get the table size in bytes.

1_sql query to find table size in sql server

Another way to get table size is the “sp_spaceused” stored procedure.

2_sql query to find table size in sql server

The column description is given below.

Rows: number of rows in a table.

Reserved:  the total amount of space allocated by objects in the database.

Data: Total amount of space used by data.

Index_size: Total amount of space used by indexes.

Unused: Total amount of space reserved for objects in the database, but not yet used.

The above description is taken from http://msdn.microsoft.com/en-us/library/ms188776.aspx

 

Regards

Ahmad Osama

Like us on FaceBook Join the fastest growing SQL Server group on FaceBook

Follow me on TwitterFollow me on FaceBook