Hi @SVA
You can create a temp table with the same structure as the procedure return,and then insert the procedure result into the temptable
-- prepare a local temp table to capture
-- the results set displayed by the stored proc
if object_id('tempdb..#soh') is not null
drop table #soh
create table #soh(
SalesOrderID int identity(1,1) not null
,OrderDate datetime not null
,CustomerID int not null
,SalesPersonID int null
,TotalDue money not null
)
-- manipulate IDENTITY_INSERT property for
-- #soh table while inserting rows
-- from the stored procedure into the table
set identity_insert #soh on
insert into #soh
(
SalesOrderID
,OrderDate
,CustomerID
,SalesPersonID
,TotalDue
)
exec uspMySecondStoredProcedure
set identity_insert #soh off
-- display values deposited into #soh
select * from #soh
Reference thread:https://www.mssqltips.com/sqlservertip/6141/save-sql-server-stored-procedure-results-to-table/#:~:text=The%20general%20solution%20for%20persisting%20a%20results%20set,tables%2C%20local%20temp%20tables%20and%20global%20temp%20tables.
Best Regards,
Isabella