Dec 11, 2011

Insert stored procedure results in temp table

INSERT STORED PROCEDURE RESULTS IN TEMP TABLE
sp_configure 'Show Advanced Options', 1
GORECONFIGURE
GO
sp_configure 'Ad Hoc Distributed Queries', 1
GORECONFIGURE
GO
SELECT * INTO #MyTempTable FROM OPENROWSET('SQLNCLI', 'Server=(local)\SQL2008;Trusted_Connection=yes;',
     'EXEC getBusinessLineHistory')
SELECT * FROM #MyTempTable