tallion

Get Table Names and Row Counts

Oct 2nd, 2011
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.22 KB | None | 0 0
  1.  
  2. SELECT
  3.     [TableName] = SO.[Name],
  4.     [RowCount] = MAX(SI.ROWS)
  5. FROM
  6.     SysObjects SO,
  7.     SysIndexes SI
  8. WHERE
  9.         SO.xtype = 'U'
  10. AND SI.Id = OBJECT_ID(SO.[Name])
  11. GROUP BY
  12.     SO.[Name]
  13. ORDER BY
  14.     2 DESC
  15.  
Advertisement
Add Comment
Please, Sign In to add comment