Skip to content

Instantly share code, notes, and snippets.

@rberrelleza
Created May 11, 2012 00:13
Show Gist options
  • Save rberrelleza/2656731 to your computer and use it in GitHub Desktop.
Save rberrelleza/2656731 to your computer and use it in GitHub Desktop.
Query to see the size of all tables on a DB
select sysobj.name, sum(reserved_page_count) * 8.0 / 1024 as 'total size (MB)'
from sys.dm_db_partition_stats sysstats, sys.objects sysobj
where sysstats.object_id = sysobj.object_id and sysobj.schema_id = schema_id('dbo')
group by sysobj.name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment