TSQL Define Temp Table (or table variable) Without Defining Schema?

前端 未结 3 1490
攒了一身酷
攒了一身酷 2021-02-03 19:02

Is there a way to define a temp table without defining it\'s schema up front?

3条回答
  •  不知归路
    2021-02-03 19:37

    you don't need OPENQUERY. Just put "INTO #AnyTableName" between the select list and the FROM of any query...

    SELECT *
        INTO #Temp1
        FROM table1
        WHERE x=y
    

提交回复
热议问题