Add a new table column to specific ordinal position in Microsoft SQL Server

后端 未结 9 985
北海茫月
北海茫月 2020-11-27 20:16

Is it possible to add a column to a table at a specific ordinal position in Microsoft SQL Server?

For instance, our tables always have CreatedOn, CreatedBy, LastModi

9条回答
  •  时光说笑
    2020-11-27 20:27

    What i think is simple is to add the column ALTER TABLE table1 ADD .. and then create a tmp table like tmp_table1 from the select like SELECT col1,col2,col5,col3,col4 into tmp_table1 from table1; and then drop table1 and rename the tmp_table1 to table1, that is it. I hope it will help someone

提交回复
热议问题