Thursday, March 29, 2012

Estimating Table Sizes

Is it possible to write a query that can estimate the space a table is
using in the database? I would like to be able to generate a report
that can display the amount of disk space a table is consuming.
How about using sp_spaceused?
RLF
<marcusq71@.gmail.com> wrote in message
news:1173901596.189278.188470@.l75g2000hse.googlegr oups.com...
> Is it possible to write a query that can estimate the space a table is
> using in the database? I would like to be able to generate a report
> that can display the amount of disk space a table is consuming.
>
|||Hello,
Go to the specific database and execute the below command to get the space
usage for all tables individually.
EXEC sp_MSForEachTable 'EXEC sp_spaceused [?]';
Thanks
Hari
<marcusq71@.gmail.com> wrote in message
news:1173901596.189278.188470@.l75g2000hse.googlegr oups.com...
> Is it possible to write a query that can estimate the space a table is
> using in the database? I would like to be able to generate a report
> that can display the amount of disk space a table is consuming.
>
|||On Mar 15, 12:46 am, "marcus...@.gmail.com" <marcus...@.gmail.com>
wrote:
> Is it possible to write a query that can estimate the space a table is
> using in the database? I would like to be able to generate a report
> that can display the amount of disk space a table is consuming.
Make sure you run DBCC UPDATEUSAGE on the database before you run
sp_spaceused
Reports and corrects inaccuracies in the sysindexes table, which may
result in incorrect space usage reports by the sp_spaceused system
stored procedure.
M A Srinivas
|||On Mar 15, 2:07 am, "M A Srinivas" <masri...@.gmail.com> wrote:
> On Mar 15, 12:46 am, "marcus...@.gmail.com" <marcus...@.gmail.com>
> wrote:
>
> Make sure you run DBCC UPDATEUSAGE on the database before you run
> sp_spaceused
> Reports and corrects inaccuracies in the sysindexes table, which may
> result in incorrect space usage reports by the sp_spaceused system
> stored procedure.
> M A Srin
Thank you all for these suggestions. This is exactly what I am
looking for. I was not clear on my initial request but the
MSforeachtable stored procedure was exactly what I was looking for.
sql

No comments:

Post a Comment