Skip to content

Instantly share code, notes, and snippets.

@BMeyerKC
Created September 28, 2018 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BMeyerKC/74e092dff093b3c59129b04580996c83 to your computer and use it in GitHub Desktop.
Save BMeyerKC/74e092dff093b3c59129b04580996c83 to your computer and use it in GitHub Desktop.
Entertaining SQL Scripts
-- Shows the tables by file size on a database
select
sum(reserved_page_count) * 8.0 / 1024
from
sys.dm_db_partition_stats
GO
select
sys.objects.name, sum(reserved_page_count) * 8.0 / 1024
from
sys.dm_db_partition_stats, sys.objects
where
sys.dm_db_partition_stats.object_id = sys.objects.object_id
group by sys.objects.name
order by 2 desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment