Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 sp_spacesused and dbcc checktable

Author  Topic 

haroldchen1999
Starting Member

7 Posts

Posted - 2009-03-26 : 12:49:39
I use the sp_spaceused tablename and dbcc checktable (tablename) returns different row count for the same table. I looks that sp_spaceused get from the statistic (I know the number is not right). Any idea or it is bug of SQL server 2005. The table with about 15 millions of rows. Thanks.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-03-26 : 12:59:17
sp_spaceused can be wrong for various reasons, you should run DBCC UPDATEUSAGE on that table and then run sp_spaceused. If in doubt, the DBCC commands will be more accurate than sp_spaceused.
Go to Top of Page

haroldchen1999
Starting Member

7 Posts

Posted - 2009-03-26 : 21:02:58
Thanks, after execute DBCC UPDATEUSAGE, it gives the right result. Thanks.
Go to Top of Page

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2009-03-27 : 02:53:55
sp_spaceused 'objectname','true'
is a better way to execute sp_spaceused as second parameter "true" will updatedusage first
Go to Top of Page
   

- Advertisement -