I have 40+ tables, based on a certain columns limit, need to get a natural key (this is a natural key of a table which exceeded the threshold limit) and a column name, column value which exceeded the limit.
Example: table f_revenue has a column rev_amt. Natural key column are revnbr and lastupdated. If rev_amt > 3000000 then
insert the natural key (revnbr, lastupdated), f_revenue, rev_amt, rev_amt exceeded 3000000
How do you create a procedure in SQL Server to dynamically scroll through 40+ tables and do as the example above?