Friday, February 10, 2012

Check the size of individual table in the database

Hi

I am trying to check the size of each table in my database?

SELECT <TableName> , 'Size in bytes/megabytes' FROM DATABASE

I can't for the lif of me figure out how this is done.

I Know if you execute

EXEC sp_HelpDB you get the size of the database, but i want each individual tables size

Any help would be greatly appreciated

Kind Regards

Carel Greaves

Check the responses to your identical question in the Database Engine forum here.

Often, the quality of the responses received is related to our ability to ‘bounce’ ideas off of each other. In the future, to make it easier for us to offer you assistance, and to prevent folks from wasting time on already answered questions, please don't post to multiple newsgroups. Choose the one that best fits your question and post there. Only post to another newsgroup if you get no answer in a day or two (or if you accidentally posted to the wrong newsgroup –and you indicate that you've already posted elsewhere).

|||

If you are not opposed to using undocumented features, you can try:

Code Snippet

exec sp_MSforeachtable 'exec sp_spaceused ''?'''

|||

Soz Arnie, I'm still Learning, won't do it again.

But while i'm on the topic.

get an error message when i execute the statement. Although the results are exactly what i want.

And when i send the results to a file it only gives me the tables names, not the stats.

The query has exceeded the maximum number of result sets that can be displayed in the results grid. Only the first 100 result sets are displayed in the grid.

|||I don't see a place where you can change that setting; you might try switching your results to text instead of the grid.|||See your other posting for my response.

No comments:

Post a Comment