Joining SP output with a table
--Set the data access option for the server
EXEC sp_serveroption 'MYSERVER', 'data access', true
--GO
USE pubs
go
CREATE TABLE #table1( i int identity)
INSERT #table1 DEFAULT VALUES
INSERT #table1 DEFAULT VALUES
go
CREATE PROC spProc1
as
SELECT 1 AS id
go
SELECT *
FROM #table1 t1 inner JOIN openquery([MYSERVER], '{call pubs..spProc1}') t2
ON t1.i = t2.id

0 Comments:
Post a Comment
<< Home