USE [Database_Name]
GO
CREATE TABLE #tblRecCount
(
tblName varchar(255),
tblRowCount int
)
EXEC sp_MSForEachTable
@command1='INSERT #tblRecCount (tblName, tblRowCount)
SELECT ''?'', COUNT(*) FROM ?'
SELECT tblName, tblRowCount
FROM #tblRecCount
ORDER BY tblName, tblRowCount DESC
SELECT SUM(tblRowCount) AS totalDbRowCount
FROM #tblRecCount
DROP Table #tblRecCount
The original post is available here.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment