[摘要]本文介绍通过查询系统表sysobjects和sysindexes实现MS SQL 查看一个数据库中所有表的行数,并提供简单的示例代码供参考。
MS SQL 查看一个数据库中所有表的行数,可以通过查询系统表sysobjects和sysindexes实现,SQL代码如下:
SELECT a.name, b.rows
FROM sysobjects AS a
INNER JOIN sysindexes AS b ON a.id = b.id
WHERE (a.type = 'u') AND (b.indid IN (0, 1))
ORDER BY b.rows DESC