Comment afficher la liste des tables avec nombre d’enregistrements dans SQL Server ?

0
601

CREATE TABLE #Tab
(
Table_Name [varchar](max),
Total_Records int
);
EXEC sp_MSForEachTable @command1=’ Insert Into #Tab(Table_Name, Total_Records) SELECT  »? », COUNT(*) FROM ?’
SELECT * FROM #Tab t ORDER BY t.Total_Records DESC;
DROP TABLE #Tab;

LEAVE A REPLY

Please enter your comment!
Please enter your name here