SQL Server: inserting the output of multiple tables from a stored procedure into separate tables

I have a stored procedure that returns multiple tables (currently used by the web service). Now I need to paste this output into the SQL Server database.

I can insert one table if I know the existing definition through

INSERT INTO #temp
    EXEC ('myProcSQlhere')

But for this I need to know the definition of the output table in advance.

SELECT *
INTO #temp
FROM OPENQUERY(SERVERNAME, 'EXEC myProcSQlhere')

Which overlooks knowledge of the definition of a table, but only allows you to enter into one table. So how do I insert data into multiple tables?

+4
source share
1 answer

. , , - . , , SQL-Server.

, proc , , . , .

, , CLR , .

+3

Source: https://habr.com/ru/post/1667972/


All Articles