Showing posts with label Find Size of Tables and Database in SQL. Show all posts
Showing posts with label Find Size of Tables and Database in SQL. Show all posts

Thursday, September 10, 2009

Find Size of Tables and Database in SQL

To know the size of tables in the database:

select object_name(id) [Table Name], [Table Size] = convert (varchar, dpages * 8) + ' KB' from sysindexes where indid in (0,1) order by dpages desc


To Know the size of the databases in the server:

SELECT name, size * (8192/(1024.*1024)) FROM sys.master_files ORDER BY size DESC