CREATE TABLE #COUNTS( TABLE_NAME VARCHAR(255), ROW_COUNT INT)
EXEC SP_MSFOREACHTABLE @COMMAND1='INSERT #COUNTS (TABLE_NAME, ROW_COUNT) SELECT ''?'', COUNT(*) FROM ?'
SELECT TABLE_NAME, ROW_COUNT FROM #COUNTS ORDER BY TABLE_NAME, ROW_COUNT DESC
DROP TABLE #COUNTS
EXEC SP_MSFOREACHTABLE @COMMAND1='INSERT #COUNTS (TABLE_NAME, ROW_COUNT) SELECT ''?'', COUNT(*) FROM ?'
SELECT TABLE_NAME, ROW_COUNT FROM #COUNTS ORDER BY TABLE_NAME, ROW_COUNT DESC
DROP TABLE #COUNTS
No comments:
Post a Comment