Wednesday, October 3, 2012

SQL 2008 - "Saving changes is not permitted." error message.. Whenever any change is made to the table in SQL Server 2008,the following message is displayed 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.

The fix to this warning is as:
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.

Note If you disable this option, you are not warned when you save the table that the changes that you made have changed the metadata structure of the table. In this case, data loss may occur when you save the table.
Risk of turning off the "Prevent saving changes that require table re-creation" option

Although turning off this option can help you avoid re-creating a table, it can also lead to changes being lost. For example, suppose that you enable the Change Tracking feature in SQL Server 2008 to track changes to the table. When you perform an operation that causes the table to be re-created, you receive the error message that is mentioned in the "Symptoms" section. However, if you turn off this option, the existing change tracking information is deleted when the table is re-created. Therefore, we recommend that you do not work around this problem by turning off the option.

To determine whether the Change Tracking feature is enabled for a table, follow these steps:
In SQL Server Management Studio, locate the table in Object Explorer.
Right-click the table, and then click Properties.
In the Table Properties dialog box, click Change Tracking.
If the value of the Change Tracking item is True, this option is enabled for the table. If the value is False, this option is disabled.

When the Change Tracking feature is enabled, use Transact-SQL statements to change the metadata structure of the table.

Steps to reproduce the problem

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.
[Source:Microsoft]


No comments: