5
我想把這個查詢的結果存儲到一個臨時表:插入的與CTE查詢結果到一個臨時表
WITH cOldest AS
(
SELECT
*,
ROW_NUMBER() OVER (PARTITION BY [MyKey] ORDER BY SomeColumn DESC) AS rnDOB
FROM MyTable
)
SELECT
C.*
*** Insert into #MyTempTable *** This part doesn't work
FROM
cOldest C
WHERE
C.rnDOB = 1
在此先感謝。
感謝馬克!我意識到爲了能夠導出臨時表,它必須是全局臨時表。進入## MyTempTable @marc_s – Ariox66 2015-03-06 07:53:36