There is a new feature of "Row Constructors" in SQL server 2008 , where I can load temp table from stored procedure directly.
Look at the following SQL where I have to use OpenQuery from server to itself creating loopback server and execute stored procedure and insert into temp table.
INSERT INTO #TempTable
SELECT *
FROM OPENQUERY(ServerName, 'exec StoredProc')
Above mentioned same query can be now written with simpler statement as described here.
INSERT INTO #TempTable
EXEC StoredProc
Note that this does not work with real tables or any other objects. This feature is only available to load temp tables.
No comments:
Post a Comment