Difference in count sp_spaceused and Count(*)

  • Hi,

    Why the difference occurs in Count between sp_spaceused and count(*).

    Can anyone please give me the solution?

    Thanks.

  • sp_spaceused can be inaccurate, unless you execute DBCC UPDATEUSAGE before.

    See BOL for more info.

    [font="Verdana"]Markus Bohse[/font]

  • There are some situations, for example, after an index is dropped, when the space information for the table may not be current. So, in order to have accurate results you have to use execute sp_spaceused @updateusage = 'TRUE' to correct the values in system tables.

    --Ramesh


Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply