Some times it is necessary to get all the table names and its row count of each table of a particular Database in SQL server 2008/2008 R2
SELECT
[TableName] = so.name, [RowCount]
= MAX(si.rows) FROM sysobjects AS so,
sysindexes AS si WHERE so.xtype =
'U' AND
si.id = OBJECT_ID(so.name) GROUP
BY
so.name ORDER BY 1 ASC
No comments:
Post a Comment