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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 When Sys.parttition,sys.indexes gets Updated
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Yak Posting Veteran

84 Posts

Posted - 01/15/2010 :  07:14:10  Show Profile  Reply with Quote
Hi All,

Guys Can u all tell me when difference between following queries exist then how to update it in system.catalogues


SELECT count(*) FROM <table>

SELECT rowcnt FROM sys.indexes WHERE Object_ID=OBJECT_ID(<TABLE>)
SELECT * FROM sys.partitions WHERE Object_ID=OBJECT_ID(<TABLE>)

I have found difference between the two queries all the time ?WHY it is SO?
How we can update the deficit therefore ?

Flowing Fount of Yak Knowledge

2916 Posts

Posted - 01/15/2010 :  08:07:57  Show Profile  Reply with Quote
count * counts every record (subject to the where clause)
count somecol only counts records with somecol notnull (ditto)
Go to Top of Page

Flowing Fount of Yak Knowledge

South Africa
4507 Posts

Posted - 01/15/2010 :  10:15:13  Show Profile  Visit GilaMonster's Homepage  Reply with Quote
DBCC UpdateUsage

Shouldn't be needed on SQL 2005, but if this DB was upgraded from SQL 2000, there could still be discrepancies.

Gail Shaw
SQL Server MVP
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000