Pages

2016-06-06

〔SQL〕一次取得所有資料表內含資料筆數 / Select Table Rows

範例:執行將顯示資料庫內所有資料表名及內含資料筆數

SELECT T .name AS [資料表名] ,
       I.rows AS [筆數]
FROM   sys .tables AS T
       INNER JOIN sys. sysindexes AS I
       ON T .object_id = I . id  AND I .indid < 2

ORDER  BY T. name