Hi All,

Find the Size of all Tables in a Database is a simple and most common requirement. And whenever I come across these requirements, I get a little nervous since I am not very good in coding/programming. I wonder how these Poker games online like http://de.partypoker.com/ program the entire thing. Anyways, back to the solution:

You might now there is s stored procedure called sp_spaceused which gives all details regarding the size of the table:

The output is as follows:

1_SQL_Server_Query_to_find_the_size_of_all_tables_in_a_database

All we need to do is: create a temporary table to record the above data items, run the code in a loop for all the tables, and record in the temp table. Here is the solution:

And you get the following output:

2_SQL_Server_Query_to_find_the_size_of_all_tables_in_a_database

HTH !

 

Regards

Rahul Sharma

Like us on FaceBook Follow us on Twitter | Join the fastest growing SQL Server group on FaceBook

Follow me on TwitterFollow me on FaceBook