apologies if this has been asked but my actual question is actually terribly difficult to query using search.
I have a table variable that I've created which constains the IDs, column names and table names of other tables such that an example row consists of
ID, Column, Table
2, AssetName, dbo.Asset
I now wish to insert into another table variable the results of a query which is composed of that row, for eg:
insert into @table2 .. 'select AssetName from dbo.Asset' [the results, specifically the AssetName column from the Asset table - perhaps 10 rows worth of data]
Please let me know how best to approach this.