Categories
SQL

SQL : View Table Row Count

SQL : View Table Row Count

The following SQL will provide table name and rowcount for every table in the local database context:
  SELECT object_name (i.id) TableName, rows as RowCnt
  FROM sysindexes i INNER JOIN sysObjects o ON (o.id = i.id AND o.xType = ‘U’)
  WHERE indid < 2
  ORDER BY RowCnt

The reults will be similar to the output below:

tableName RowCnt
 messages  6342
 orders  3221
 dealer  101

Leave a Reply

Your email address will not be published. Required fields are marked *