sql server - Simple Sql Procedure with/without cursor -


please me simple procedure, lets on sql server (2005, 2008, not matter).

i have table dbo.[columns] 1000 lines, names specific table names database.

bottom line need create procedure parse 1000 lines of tables, each table name found in dbo.[columns] execute following

select: select count(*), ''''+[column_name]+'''' dbo.[column_name] 

the result should this:

count(*)    table_name: 100          employees  0            ex_employees 25           addresses 10           birthdays 

any hints?

thanks in advance, bogdan

select  count(column_with_list_of_table_names_here)         , column_with_list_of_table_names_here    yourdatabase.dbo.yourtable group column_with_list_of_table_names_here; 

Comments