Sunday, October 17, 2010

Find table size used in SQL Server

In a database, when size is growing then we have to find which table is taking more size. Then we have to query database to find what is the table taking maximum size. Log is also one of the factor which causes the database size grow in very huge amount. But, except logs, if you want to find the table which takes max size is, then use below command.

Command:
EXEC sp_spaceused 'Student'

Output:
namerowsreserveddataindex_sizeunused
Student918464 KB256 KB152 KB56 KB

So, using the system stored procedure "SP_SpaceUsed", we will find the table size used. The only input parameter the SPROC expects is table name.
Hope you enjoyed this post.

No comments:

Post a Comment