Add Column on SQL Server on Specific Place?

前端 未结 9 1619
-上瘾入骨i
-上瘾入骨i 2021-01-19 02:12

I would like to know if there\'s a way to add a column to an SQL Server table after it\'s created and in a specific position??

Thanks.

9条回答
  •  再見小時候
    2021-01-19 02:34

    You can do that in Management-Studio. You can examine the way this is accomplished by generating the SQL-script BEFORE saving the change. Basically it's achieved by:

    • removing all foreign keys
    • creating a new table with the added column
    • copying all data from the old into the new table
    • dropping the old table
    • renaming the new table to the old name
    • recreating all the foreign keys

提交回复
热议问题