Posted By

blackf0rk on 04/28/09


table list count return row

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Return a table list with row count

 / Published in: SQL

This will return a list of all the tables in a certain database along with their row count.

  1. SELECT DISTINCT convert(varchar(30),object_name( [TABLE Name], a.rows
  2. FROM sysindexes a INNER JOIN sysobjects b ON =
  3. INNER JOIN INFORMATION_SCHEMA.TABLES c ON c.[TABLE_NAME]=convert(varchar(30),object_name(
  4. WHERE c.Table_catalog='DATABASE NAME'

Report this snippet  

You need to login to post a comment.