Tuesday, 30 October 2018

List of Tables with Row count

By using sys.tables and sys.partitions we can find a list of database tables with number records(rows) in a table.

Query :


SELECT DISTINCT t.NAME AS TableName,
                p.rows AS RowCounts
FROM sys.tables t
INNER JOIN sys.partitions p ON t.object_id = p.OBJECT_ID
ORDER BY t.Name

0 comments:

Post a Comment

Please do not enter any spam link in the message box.