SQL Server Management Studio - Adding/Moving Columns require drop and re-create?

前端 未结 5 1623
轻奢々
轻奢々 2021-02-04 03:47

Why do I get message that the table needs to dropped and re-created when I add/move columns? I believe this happens after adding foreign key constraints.

What can I do t

5条回答
  •  攒了一身酷
    2021-02-04 04:30

    When you edit a table definition in the designer, you are saying "here's what I want the table to look like, now work out what SQL statements to issue to make my wishes come true". This works fine for simple changes, but the software can't read your mind, and sometimes it will try to do things in a more complicated way for safety.

    When this happens, I suggest that, instead of just clicking OK, click the "Script" button at the top of the dialog, and let it generate the SQL statements into a query window. You can then edit and simplify the generated code before executing it.

提交回复
热议问题