I need to create and populate a table with the table name and row count for selected tables. Getting the row count is the problem. The following script illustrates what I need to do, but the select count(*) statement returns an invalid object error on table_name.
create table tablerowcount
(tablename sysname,
rowcount bigint)
insert tablerowcount
select table_name, (select count(*) from table_name)
from information_schema.columns
where column_name = 'sub'
Would appreciate anyone who could point me in the right direction.
Thanks
create table tablerowcount
(tablename sysname,
rowcount bigint)
insert tablerowcount
select table_name, (select count(*) from table_name)
from information_schema.columns
where column_name = 'sub'
Would appreciate anyone who could point me in the right direction.
Thanks