Please help me with a simple procedure, lets say on Sql Server (2005, 2008, does not matter).
I have table dbo.[columns] with 1000 lines, which all are the names for some specific table names from a database.
Bottom line is that I need to create a procedure which will parse all 1000 lines of tables, for each table name found in dbo.[columns] to execute the following
select: select count(*), ''''+[column_name]+'''' from dbo.[column_name]
The result should be like 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
FROM YourDatabase.dbo.YourTable
GROUP BY Column_With_List_Of_Table_Names_Here;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With