Back
In mssql2005 when I want to get the size of a table in MBs, I use EXEC sp_spaceused 'table'.
Is there any way to get space used by a particular table in SQL Azure using some query or API?
Refer this blog :http://dunnry.com/blog/CalculatingTheSizeOfYourSQLAzureDatabase.aspx
select sum(reserved_page_count) * 8.0 / 1024 [SizeInMB]from sys.dm_db_partition_statsGOselect sys.objects.name, sum(reserved_page_count) * 8.0 / 1024 [SizeInMB]from sys.dm_db_partition_stats, sys.objectswhere sys.dm_db_partition_stats.object_id = sys.objects.object_idgroup by sys.objects.nameorder by sum(reserved_page_count) DESC
select
sum(reserved_page_count) * 8.0 / 1024 [SizeInMB]
from
sys.dm_db_partition_stats
GO
sys.objects.name, sum(reserved_page_count) * 8.0 / 1024 [SizeInMB]
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 sum(reserved_page_count) DESC
At first, you will get the size of your database in MB and the second one will do the same, just break them out for each of the object in your Database ordered from largest to smallest.
31k questions
32.8k answers
501 comments
693 users