开发者

SQL Server Express: Failed to add primary key after creating a database table

Scenario: I have created a database table. And when I tried to add a primary key (using the SQL Server Management Studiio) to the table, it failed with an error message "Saving changes is not permitted. The changes you开发者_开发技巧 have made requrie the following tables to be dropped and re-created. You have either made changes to a table that can't be recreated or enabled the option Prevent savign changes that require the table to be re-created."

The environment is Windows 7.

I have earlier installed it on a Windows XP SP2 and it worked.

And yes, my table is empty (freshly created).

My current workaround is to run the "Drop and Create" script. The other alternative is to create the primary key before I save the table.

Is this a bug or a limitation with the Express version?


There is an option in Visual Studio that doesn't allow you to save changes that require Recreating the database. If you un-check that option everything should work.

Off the top of my head I believe it is under:

Tools > Options > Database Tools > Table and Database Designers

There you should un-check the "Prevent Saving Changes that Require Table Recreation" or something similar to this.


With SQL Manager Studio which is comming with SQL Server Express 2012 :

Tools > Options > Designers > Table and Database Designers

uncheck "Prevent saving changes that require table re-creation"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜