/ Published in: SQL
Get number of rows in each table of the database (MSSQL)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
CREATE TABLE #tmpOutput (TableName VARCHAR(300), TableRowCount INT) EXEC dbo.sp_MSForEachTable 'INSERT INTO #tmpOutput(TableName, TableRowCount) SELECT ''?'', COUNT(*) FROM ?' SELECT TableName, TableRowCount FROM #tmpOutput ORDER BY TableRowCount DESC DROP TABLE #tmpOutput