2016-08-20 43 views

回答

1

起初啓用幾個選項:

sp_configure 'Show Advanced Options', 1 
GO 
RECONFIGURE 
GO 
sp_configure 'Ad Hoc Distributed Queries', 1 
GO 
RECONFIGURE 
GO 

然後你可以使用OPENROWSET

SELECT * INTO #Temp124 
FROM OPENROWSET('SQLNCLI', 'Server=(local)\InstanceName;Trusted_Connection=yes;', 
    'EXEC usp_GetTagDetails @UserId=1,@IsActiveOnly=1,@IsParentPathRequired=1') 

另一種方法來創建表的手動存儲來自SP的數據,但你應該知道什麼樣的數據本SP返回。

CREATE TABLE #temp124 (
    Col1 int, 
    Col2 nvarchar=(max), 
    ...etc 
) 

INSERT INTO #temp124 
EXEC usp_GetTagDetails @UserId=1,@IsActiveOnly=1,@IsParentPathRequired=1