直接插入到临时表
SELECT * INTO #TempTable FROM OPENROWSET(
'SQLOLEDB','SERVER=servername;uid=sa;pwd=yourpwd;Database=DBName',
'SET FMTONLY OFF;SET NOCOUNT ON; EXEC YourProcedure')AS A
SELECT * FROM #TempTable
DROP TABLE #TempTable
SELECT * INTO #TempTable FROM OPENROWSET(
'SQLOLEDB','SERVER=servername;uid=sa;pwd=yourpwd;Database=DBName',
'SET FMTONLY OFF;SET NOCOUNT ON; EXEC YourProcedure')AS A
SELECT * FROM #TempTable
DROP TABLE #TempTable
同时也可以直接使用自定义函数.
定义好函数后,可使用select * from fn_yourfunction进行查询.