Solution for Creating temporary table with dynamic columns
is Given Below:
I have a stored procedure which is returning few columns (now this stored procedure is being managed by other teams so they can add further columns in it)
ALTER SP MyCallingSP AS SELECT col1, col2, col3, col4 FROM Table END
I am calling this stored procedure from my C# code in which I am inserting the result set into a data table.
Now, I have to create a global temporary table from this datatable.
Problem is, tomorrow they can add a new column in it and then it might fail my process.
From the above example, I just need col1, col2, col3 which I want to insert into a global temporary table.
I am able to get the data into datatable but I am not sure about how to proceed further.