Home > Archive > MS SQL Server > October 2006 > table row count in system table?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author table row count in system table?
coenzyme

2006-10-24, 6:38 pm

Hi all,
Is there a system table that tracks the row count of all tables in a
single DB? Is there a stored procedure that displays that info?
I've received some great scripts from you people that query the
tables in the DB for the row count of all tables , but the overhead is
high.
Also I've observed the tables displayed in SQL 2000 master system DB,
and SQL 2005 master system DB are very different. Are there that many
fewer tables in the 2005 master system DB, or are they "hidden". If
so can they be accessed? Thanks for everyone for being there to
help.

SQL 2000 SP4 and SQL 2005 SP1
Ed
Kart

2006-10-24, 6:38 pm

SELECT O.[name]
,I.rowcnt
FROM sysobjects O
JOIN sysindexes I
ON O.[id] = I.[id]
WHERE O.xtype = 'U'
AND O.status > 0
AND I.indid = 1


In case the table does not have a clustered index, make indid = 0

coenzyme wrote:
> Hi all,
> Is there a system table that tracks the row count of all tables in a
> single DB? Is there a stored procedure that displays that info?
> I've received some great scripts from you people that query the
> tables in the DB for the row count of all tables , but the overhead is
> high.
> Also I've observed the tables displayed in SQL 2000 master system DB,
> and SQL 2005 master system DB are very different. Are there that many
> fewer tables in the 2005 master system DB, or are they "hidden". If
> so can they be accessed? Thanks for everyone for being there to
> help.
>
> SQL 2000 SP4 and SQL 2005 SP1
> Ed


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com