2012-01-19 72 views

回答

3

你可以OUTPUT ... INTO第二張表。

Execution Plan

CREATE TABLE #tmpTest1 
    (
    FirstCol INT 
); 

CREATE TABLE #tmpTest2 
    (
    FirstCol INT 
); 

INSERT INTO #tmpTest1 
    OUTPUT inserted.FirstCol 
INTO #tmpTest2 
SELECT 1; 

SELECT * 
    FROM #tmpTest1; 

SELECT * 
    FROM #tmpTest2; 

DROP TABLE #tmpTest1; 

DROP TABLE #tmpTest2; 
+0

+1做得好! :d –

相關問題