Thursday, March 01, 2012 11:38 AM
I have a table with a computed column in my database project:
create table MyTable ( NameCode char(7), AddressCode char(3), Name nvarchar(80), FullAddress nvarchar(max), FullCode char(10), constraint PK_MyTable primary key (NameCode, AddressCode), constraint UQ_MyTable unique (FullCode) )
Each time when I deploy the project, the Unique Key is dropped, the column FullCode is dropped, the column FullCode is added back again and the Unique Key is created again.
Is this a bug, or implemented by design?
Programmers do it Bit by Bit
Friday, March 02, 2012 9:35 AMModerator
I am sorry that I can't reproduce the same issue as you, with the script you offered above, I just have the Unique key and the FullCode column created for the first time when I deploy the database project. In addition, what about other database objects? Will they be deleted and recreated again as well? If so, please make sure you don't select the "Always re-create database" option in the Database.sqldeployment file.
And if the above workaround does not resolve your issue, I think maybe there are some other database objects in the database project cause you the Unique key and the column re-created. It is better if you can provide me the sample project which can reproduce your issue. I would like to take a look at of it for you.
Vicky Song [MSFT]
MSDN Community Support | Feedback to us
- Marked As Answer by Vicky SongModerator Monday, March 26, 2012 2:18 AM