如果我想在一个表中保存任何更改,以前保存在SQL Server Management Studio(表中没有数据),我会得到一个错误消息:

不允许保存更改。所做的更改需要 下面要删除并重新创建的表。你要么做了 对不能重新创建或启用该选项的表的更改 防止保存需要重新创建表的更改。

什么可以防止表格被轻易编辑?或者,这是SQL Server Management Studio要求重新创建表进行编辑的通常方式吗?这个“阻止保存更改选项”是什么?


当前回答

要解决这个问题,可以使用SQL语句对表的元数据结构进行更改。

启用“防止保存需要重新创建表的更改”选项时,会出现此问题。

来源:当您尝试在SQL Server 2008中保存表时,错误消息:“不允许保存更改”

其他回答

您应该停止以这种方式编辑数据,而不是取消复选框(一个糟糕的解决方案)。如果必须更改数据,那么使用脚本进行更改,这样您就可以轻松地将其移植到生产环境中,从而使其处于源代码控制之下。这也使得在将生产推到开发后更容易刷新测试更改,从而使开发人员能够使用更新鲜的数据。

进入工具->选项->设计器->取消勾选“防止保存需要重新创建表的更改”。瞧。

发生这种情况是因为有时需要删除并重新创建表以更改某些内容。这可能需要一段时间,因为所有数据都必须复制到临时表,然后重新插入到新表中。由于SQL Server默认不相信你,你需要说“好吧,我知道我在做什么,现在让我做我的工作。”

要解决这个问题,可以使用SQL语句对表的元数据结构进行更改。

启用“防止保存需要重新创建表的更改”选项时,会出现此问题。

来源:当您尝试在SQL Server 2008中保存表时,错误消息:“不允许保存更改”

工具|选项|设计器|表和数据库设计器

取消选中“防止保存需要重新创建表的更改”选项。

步骤重现问题

In SQL Server Management Studio, create a table that contains a primary key in the Table Designer tool. Right-click the database that contains this table, and then click Properties. In the Database Properties dialog box, click Change Tracking. Set the value of the Change Tracking item to True, and then click OK. Right-click the table, and then click Properties. In the Table Properties dialog box, click Change Tracking. Set the value of the Change Tracking item to True, and then click OK. On the Tools menu, click Options. In the Options dialog box, click Designers. Click to select the Prevent saving changes that require table re-creation check box, and then click OK. In the Table Designer tool, change the Allow Nulls setting on an existing column. Try to save the change to the table.