The fun of working with legacy code.
I have a situation where there is some dynamic sql generated as a result of reading column names in from one query and using that as the select of another query. All dynamic sql and I would love to get rid of it.
Can someone provide an example of how to get column names from one query and use those as the select of another
Something along the lines of
Select columnname value from table 1
returns vendorid, vendorname, etc
and then uses that in another query
select vendorid, vendorname, etc from table 2
There are over a 100 columnnames