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
 Transact-SQL (2005)
 Select Rowcnt From sys.sysindexes

Author  Topic 

rajdaksha
Aged Yak Warrior

595 Posts

Posted - 2009-07-29 : 06:27:14
Hi

If am using this below query..is need to check the schema of the object...?

Select Rowcnt From sys.sysindexes where id = <Object_ID> AND indid IN (0 ,1)

-------------------------
R..

raky
Aged Yak Warrior

767 Posts

Posted - 2009-07-29 : 08:07:35
no need to have the schema...

Just run the below stmt to know that there is no difference

select object_id('tablename'),object_id('dbo.tablename')
Go to Top of Page

rajdaksha
Aged Yak Warrior

595 Posts

Posted - 2009-07-29 : 08:25:57
Hi raky

thanks a Lot

-------------------------
R..
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-07-29 : 08:39:56
quote:
Originally posted by rajdaksha

Hi

If am using this below query..is need to check the schema of the object...?

Select Rowcnt From sys.sysindexes where id = <Object_ID> AND indid IN (0 ,1)

-------------------------
R..


You need to run DBCC UPDATEUSAGE ('database_name','table_name') WITH COUNT_ROWS to get correct row count
Refer
http://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/02/different-ways-to-count-rows-from-a-table.aspx


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -