时间:2021-07-01 10:21:17 帮助过:3人阅读
CREATE TABLE #RowCounts(NumberOfRows BIGINT,TableName VARCHAR(128))
EXEC sp_MSForEachTable ‘INSERT INTO #RowCounts
SELECT COUNT_BIG(*) AS NumberOfRows,
‘‘?‘‘ as TableName FROM ?‘
SELECT TableName,NumberOfRows
FROM #RowCounts
ORDER BY NumberOfRows DESC,TableName
DROP TABLE #RowCounts
sp_MSForEachTable是SqlServer中没有Document下来的存储过程。
SqlServer中获取数据库中每个表的行数
标签: