I have a stored procedure for query some data. I want get this data and put into table or update the table with these data. how can i get this? I have tried many methods and all fail. somebody can help me please??
1 Answer
You can run the Stored Procedure using OPENQUERY if it doesn't use parameters, or if you can hardcode the parameters, e.g.
update othertable
set ....
from openquery([SQLSERVER], 'exec ABC') X
join othertable ....
(Replace SQLSERVER with the name of the server/instance.)
Or you can put the data from the proc into a temp table then join to it, e.g.
insert #tmptablename
exec ABC 1,2,3
(where you first create #tmptablename with the exact columns expected from the resultset from proc "ABC")