sqlserver统计所有表记录数
CREATE PROCEDURE [dbo].[StaticTableCount]
AS
BEGIN
CREATE TABLE #temp (TableName VARCHAR (255), RowCnt INT)
EXEC sp_MSforeachtable 'INSERT INTO #temp SELECT ''?'', COUNT(*) FROM ?'
SELECT TableName, RowCnt FROM #temp ORDER BY RowCnt desc
DROP TABLE #temp
原创
2020-06-16 20:34:07 ·
867 阅读 ·
0 评论