How to create Temp table with SELECT * INTO tempTable FROM CTE Query

前端 未结 6 1292
执笔经年
执笔经年 2020-12-04 05:39

I have a MS SQL CTE query from which I want to create a temporary table. I am not sure how to do it as it gives an Invalid Object name error.

Below is t

6条回答
  •  一向
    一向 (楼主)
    2020-12-04 05:48

    Here's one slight alteration to the answers of a query that creates the table upon execution (i.e. you don't have to create the table first):

    SELECT * INTO #Temp
    FROM (
    select OptionNo, OptionName from Options where OptionActive = 1
    ) as X
    

提交回复
热议问题