Hi,
I have around 400+ tables in MS-SQL.
Need to know the table name with number of rows of each table. Doing this individually will be tedious.
Is there a query thru which i can get the table name & no. of rows.
I tried some of the queries given in certain websites but didn't work. One of them I tried which was given in this forum, as given below
but the Cnts table was blank. Do I need to give any parameter in the stored procedure sp_MSForEachTable ?
CREATE TABLE ##Cnts (
Table_name varchar(100) NOT NULL
, Cnt int NOT NULL
)
sp_MSForEachTable 'INSERT ##Cnts SELECT '?' AS Table_Name, COUNT(*) Cnt FROM ?'
SELECT * FROM ##Cnts
TIA,
RAJ
I have around 400+ tables in MS-SQL.
Need to know the table name with number of rows of each table. Doing this individually will be tedious.
Is there a query thru which i can get the table name & no. of rows.
I tried some of the queries given in certain websites but didn't work. One of them I tried which was given in this forum, as given below
but the Cnts table was blank. Do I need to give any parameter in the stored procedure sp_MSForEachTable ?
CREATE TABLE ##Cnts (
Table_name varchar(100) NOT NULL
, Cnt int NOT NULL
)
sp_MSForEachTable 'INSERT ##Cnts SELECT '?' AS Table_Name, COUNT(*) Cnt FROM ?'
SELECT * FROM ##Cnts
TIA,
RAJ