SQL 服务器:无法保存/更改表设计
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20963738/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SQL server: can't save/change table design
提问by joe
I'm trying to make changes to an existing table and am getting this error when i try to save :
我正在尝试对现有表进行更改,但在尝试保存时出现此错误:
Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-created.
不允许保存更改。您所做的更改需要删除并重新创建以下表。您对无法重新创建的表进行了更改,或者启用了阻止保存需要重新创建表的更改选项。
I only have one data entry in the database - would deleting this solve the problem or do i have to re-create the tables as the error suggests? (This is on SQL-Server 2008 R2)
我在数据库中只有一个数据条目 - 删除它会解决问题还是我必须按照错误提示重新创建表?(这是在 SQL-Server 2008 R2 上)
回答by Nagaraj S
The following actions might require a table to be re-created:
以下操作可能需要重新创建表:
- Adding a new column to the middle of the table
- Dropping a column
- Changing column nullability
- Changing the order of the columns
- Changing the data type of a column
- 在表格中间添加一个新列
- 删除列
- 更改列可空性
- 更改列的顺序
- 更改列的数据类型
To change this option, on the Tools menu, click Options, expand Designers, and then click Table and Database Designers. Select or clear the Prevent saving changes that require the table to be re-created check box.
若要更改此选项,请在“工具”菜单上,单击“选项”,展开“设计器”,然后单击“表和数据库设计器”。选中或清除阻止保存需要重新创建表的更改复选框。
回答by Ali Adravi
you need to change settings to save the changes
您需要更改设置以保存更改
- Open SQL Server Management Studio (SSMS).
- On the Tools menu, click Options.
- In the navigation pane of the Options window, click Designers.
- Select or clear the Prevent saving changes that require the table re-creation check box, and then click OK.
- 打开 SQL Server Management Studio (SSMS)。
- 在工具菜单上,单击选项。
- 在选项窗口的导航窗格中,单击设计器。
- 选中或清除阻止保存需要重新创建表的更改复选框,然后单击确定。
回答by sk2185
Goto -> Tools -> Options->Designers-> Warn on null primary keys and
Warn about tables affected
uncheck and try again
取消选中并重试