I need a query to insert data into temp table with columns (dbname, schemaname, tablename,query_id, select_cols, join_on, where_clause).
These are the cols I required and select_cols, join_on, where_clause columns must retreive from an XML query.
Eg: I have created two table and join them. Query is like:
select id, name, gender, marks, address
from #temp a
inner join #temp1b on a.id=b.id
I need to insert into XML and then create table like below
So I need table like:
Dbname | schema |table | queryid | select | on ---colnames
Tempdb | dbo |#temp | 1 | id,name,.. | id ----values
Tempdb|dbo | #temp2 |2 |address |id
Can someone help me on this. Thanks in advance.