SQL Server query the number of rows in all tables in the database

SELECT a.name, b.rows
FROM sysobjects AS a INNER JOIN sysindexes AS b ON a.id = b.id
WHERE (a.type = 'u') AND (b.indid IN (0, 1))

ORDER BY b.rows DESC

Note that switch to the corresponding library first, and this statement needs to be executed under the specified library.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324473302&siteId=291194637