cookieChoices = {};

Wednesday, 4 May 2016

List of tables with number of records

List of tables with number of records


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;

No comments:

Post a Comment