Allowing Table Re-Creation in SQL Server 2008

Posted: 12 Şubat 2013 in SQL, SQL SERVER

QL Server 2008 introduced a new default setting that prevents changes being made to the schema if those modifications would require a table to be dropped and recreated. This article explains how to change the default option.

Table Re-Creation

Some changes to the schema of a SQL Server database are not possible to make without dropping and recreating a table. Such changes include changing the order of columns in a table or modifying a column’s “Allow Nulls” setting. If you attempt one of these changes within Microsoft SQL Server Management Studio (SSMS) you will see an error dialog with the following message:

Saving changes is not permitted. The changes you have made require the following tables to be
dropped and re-created. You have wither 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 message is displayed because changes that require the re-creation of a table can have unforeseen consequences. One of the problems is that if you are using change tracking, this information will be lost when the table is dropped. In such cases it is better to make the changes using a series of Transact-SQL (T-SQL) statements to avoid any data loss.

When working with databases during development it can be useful to disable the setting so that design changes can be made more quickly. To do so, open the Tools menu in SSMS and select Options. In the tree at the left of the dialog box that appears, expand the Designers section and select “Table and Database Designers”. You can now use the checkbox to disable the “Prevent saving changes that require the table to be re-created” option.

SQL Server 2008 Table and Database Designer Options

Bir Cevap Yazın

Aşağıya bilgilerinizi girin veya oturum açmak için bir simgeye tıklayın:

WordPress.com Logosu

WordPress.com hesabınızı kullanarak yorum yapıyorsunuz. Log Out / Değiştir )

Twitter resmi

Twitter hesabınızı kullanarak yorum yapıyorsunuz. Log Out / Değiştir )

Facebook fotoğrafı

Facebook hesabınızı kullanarak yorum yapıyorsunuz. Log Out / Değiştir )

Google+ fotoğrafı

Google+ hesabınızı kullanarak yorum yapıyorsunuz. Log Out / Değiştir )

Connecting to %s