Friday, October 26, 2012

How to get the table size in SQL server 2008


To get the table size in SQL Server 2008, we need to use a system stored procedure viz. sp_spaceused
If we pass Table Name as an argument, it gives the disk space used by the table and some other information like: Number of rows existing in the table, Total amount of reserved space for Table, Total amount of space reserved for table but not yet used, Total amount of space used by indexes in Table.








                                                                       


Example: 
For the ADDRESS table in our database, if we run

  sp_spaceused      'TADDRS'
it will give following result:

name
rows
reserved
data
index_size
unused
TADDRS
4726
392 KB
320 KB
16 KB
56 KB


               
                                               

No comments:

Post a Comment