Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase ««12

Finding no. of Rows in all tables of a datbase in one line of script Expand / Collapse
Posted Tuesday, January 11, 2011 12:23 PM


Group: General Forum Members
Last Login: Thursday, August 11, 2016 3:37 PM
Points: 108, Visits: 392
In my experience, every table has a row in sys.sysindexes that can be used to tell the number of rows in the table.

SELECT i.rowcnt, 
FROM sys.sysobjects o JOIN sys.sysindexes i ON =
WHERE o.xtype = 'U' AND i.indid IN (0, 1)

Because these values are stored in the system tables, this is not an expensive query.
Post #1046080
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse