Sql Server'不允许保存更改'错误►防止保存需要重新创建表的更改

本文翻译自:Sql Server 'Saving changes is not permitted' error ► Prevent saving changes that require table re-creation

When I create a table in SQL Server and save it, if I try to edit the table design, like change a column type from int to real, I get this error: 当我在SQL Server中创建一个表并保存它时,如果我尝试编辑表设计,比如将列类型从int更改为real,我会收到以下错误:

Saving changes is not permitted. 不允许保存更改。 The change you have made requires the following table to be dropped and re-created. 您所做的更改需要删除并重新创建下表。 You have either made changes to a table that can't be recreated or enabled the option prevent saving changes that require the table to be re-created. 您已对无法重新创建或启用的表进行了更改,该选项会阻止保存需要重新创建表的更改。

Why do I have to re-create the table? 为什么我要重新创建表? I just want to change a data type from smallint to real . 我只想将数据类型从smallint更改为real

The table is empty, and I didn't use it until now. 该表是空的,直到现在我才使用它。


#1楼

参考:https://stackoom.com/question/SZhZ/Sql-Server-不允许保存更改-错误-防止保存需要重新创建表的更改


#2楼

Go on Tool located at top menu. 转到位于顶部菜单的工具
Choose options from dropdown.You have a popup now select Designers option located on left hand block of menus. 从下拉列表中选择选项 。您现在有一个弹出窗口,选择位于菜单左侧块的设计器选项。 Uncheck the option Prevent saving changes that require table re-creation . 取消选中“ 禁止保存需要重新创建表的更改 ”选项。 Click on OK Button. 单击“确定”按钮。


#3楼

It is very easy and simple setting problem that can be fixed in 5 seconds by following these steps 这是非常容易和简单的设置问题,可以通过以下步骤在5秒内修复

To allow you to save changes after you alter table, Please follow these steps for your sql setting: 为了允许您在更改表后保存更改,请按照以下步骤进行SQL设置:

  1. Open Microsoft SQL Server Management Studio 2008 打开Microsoft SQL Server Management Studio 2008
  2. Click Tools menu options, then click Options 单击工具菜单选项,然后单击选项
  3. Select Designers 选择设计师
  4. Uncheck "prevent saving changes that require table re-creation" option 取消选中“阻止保存需要重新创建表的更改”选项
  5. Click OK 单击确定
  6. Try to alter your table 试着改变你的桌子
  7. Your changes will performed as desired 您的更改将根据需要执行

#4楼

Prevent saving changes that require table re-creation 防止保存需要重新创建表的更改

Five swift clicks 五次快速点击

通过五次单击阻止保存需要重新创建表的更改

  1. Tools 工具
  2. Options 选项
  3. Designers 设计师
  4. Prevent saving changes that require table re-creation 防止保存需要重新创建表的更改
  5. OK . 好的

After saving, repeat the proceudure to re-tick the box. 保存后,重复该过程以重新勾选该框。 This safe-guards against accidental data loss. 这可以防止意外数据丢失。

Further explanation 进一步说明

  • By default SQL Server Management Studio prevents the dropping of tables, because when a table is dropped its data contents are lost.* 默认情况下,SQL Server Management Studio会阻止删除表,因为删除表时,其数据内容将丢失。*

  • When altering a column's datatype in the table Design view, when saving the changes the database drops the table internally and then re-creates a new one. 在表设计视图中更改列的数据类型时,在保存更改时,数据库会在内部删除表,然后重新创建新表。

*Your specific circumstances will not pose a consequence since your table is empty. *由于您的桌子是空的,您的具体情况不会造成后果。 I provide this explanation entirely to improve your understanding of the procedure. 我完全提供这个解释,以提高您对程序的理解。


#5楼

Copied from this link " ... Important We strongly recommend that you do not work around this problem by turning off the Prevent saving changes that require table re-creation option. For more information about the risks of turning off this option, see the "More information" section. '' 从此链接复制“...重要我们强烈建议您不要通过关闭”防止需要重新创建表格的保存更改“来解决此问题。有关关闭此选项的风险的详细信息,请参阅”更多信息“部分。”

" ...To work around this problem, use Transact-SQL statements to make the changes to the metadata structure of a table. For additional information refer to the following topic in SQL Server Books Online “...要解决此问题,请使用Transact-SQL语句对表的元数据结构进行更改。有关其他信息,请参阅SQL Server联机丛书中的以下主题

For example, to change MyDate column of type datetime in at table called MyTable to accept NULL values you can use: 例如,要在名为MyTable的表中更改datetime类型的MyDate列以接受NULL值,您可以使用:

alter table MyTable alter column MyDate7 datetime NULL " alter table MyTable alter column MyDate7 datetime NULL“


#6楼

1) Open tool which is on top. 1)打开顶部的工具。
2) Choose options from Picklist. 2)从Picklist中选择选项。
3) Now Comes the popup and you can now select designers option from the list of menus on the left side. 3)现在进入弹出窗口,您现在可以从左侧菜单列表中选择设计器选项。
4) Now prevent saving changes need to be unchecked that needed table re-creation. 4)现在防止需要取消选中需要重新创建表的保存更改。 Now Click OK. 现在单击OK。

发布了0 篇原创文章 · 获赞 8 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/asdfgh0077/article/details/105486219