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 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy