Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting stored procedure results into a temp table

Status
Not open for further replies.

normiebongos

Programmer
Apr 17, 2001
1
CA
I have a SQL Server 6.5 database with a stored procedure on it that can't be changed in any way. I have control over a local SQL Server 7.0 database that has a linked server to the 6.5 server. What I need is the syntax to take the results from the remote stored procedure and store them into a temptable on my local machine.

In essence what I want to do is this...

SELECT * FROM
(exec remote_server.remote_dbs.dbo.sp_remote_proc param)
INTO #mytemptable

Hope someone can help.

Peace,
Norm

 
Here is a samll piece SQL Code that I think is what you are looking for.

TRUNCATE TABLE tmpTable (your table name replaces tmptable)

INSERT INTO tmpTable

SELECT insert your select code
 

This is the code you need.

insert #mytemptable
exec remote_server.remote_dbs.dbo.sp_remote_proc param
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top