SQL exclude a column using SELECT * [except columnA] FROM tableA?

后端 未结 30 2528
花落未央
花落未央 2020-11-21 23:15

We all know that to select all columns from a table, we can use

SELECT * FROM tableA

Is there a way to exclude column(s) from a table witho

30条回答
  •  死守一世寂寞
    2020-11-22 00:07

    A colleage advised a good alternative:

    • Do SELECT INTO in your preceding query (where you generate or get the data from) into a table (which you will delete when done). This will create the structure for you.
    • Do a script as CREATE to new query window.
    • Remove the unwanted columns. Format the remaining columns into a 1 liner and paste as your column list.
    • Delete the table you created.

    Done...

    This helped us a lot.

提交回复
热议问题