January 5, 2011 at 2:22 am
Hi Friends
Hope you doing well. I am in need to find the row count for all views and tables in a database in sql 2005 & 2008 version.I tried it is taking very long time to return the result Could you help in this.
Cheers,
vino
January 5, 2011 at 2:26 am
For tables you can query sys.partitions. The row count is in there (filter for index_id in 0,1). For views you'll have to run SELECT Count(*), the row counts aren't stored as they are just saved select statements, they don't store data.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 5, 2011 at 8:19 am
Hi,
The sys.partitions table can be used for records count in a table.
You can check article for more samples and sql scripts on SQL RowCount using sys.partitions
Using sys.partitions view is actually very fast for this task instead of using select count(*) method
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply