2012-05-23 101 views
1

我已經在MS Sql Server 2008中創建了數據透視表。如何將生成的數據透視表保存到永久表中?如何將數據透視表保存爲永久表

SELECT * 
FROM (SELECT yr as [year], lname as [player], avg_rating as Rating 
    FROM pool_ratings_yr1) as s 
PIVOT 
    (SUM(Rating) FOR [player] in (greenleaf, maturo, allen, caras, concannon, taberski, mosconi, weston, seaback, deoro, blankenship, ralph, keough, kreuter, layton, hueston, rudolph, lauri)) AS pool_pivot 

感謝, 威爾

回答

0

使用SELECT INTO

SELECT * 
INTO dbo.Permanent_Table_1 
FROM 
(
    SELECT yr as [year], lname as [player], avg_rating as Rating 
    FROM dbo.pool_ratings_yr1 
) as s 
PIVOT 
(
    SUM(Rating) FOR [player] in (greenleaf, maturo, allen, caras, 
     concannon, taberski, mosconi, weston, seaback, deoro, blankenship, 
     ralph, keough, kreuter, layton, hueston, rudolph, lauri) 
) AS pool_pivot; 
+0

完美!非常感謝。 –