查询sqlserver 数据库中各表条数
SELECT  ROW_NUMBER() OVER (ORDER BY All_Table.NAME) AS NO, 
            All_Table.NAME AS '表名(EN)',
            CONVERT(NVARCHAR(100),ISNULL(TableDesc.[VALUE],'-')) AS '表名(CN)',
            TabIndex.ROWS AS '记录数'
            FROM SYS.TABLES All_Table 
LEFT JOIN SYS.EXTENDED_PROPERTIES TableDesc ON (All_Table.OBJECT_ID = TableDesc.MAJOR_ID AND TableDesc.MINOR_ID = 0)--取表的名称两个条件
INNER JOIN SYSINDEXES TabIndex ON All_Table.OBJECT_ID=TabIndex.ID AND TabIndex.INDID < 2 

WHERE 1=1
 ORDER BY TabIndex.ROWS DESC

 

posted on 2023-07-05 10:30  黑寡妇001  阅读(80)  评论(0编辑  收藏  举报