I had a reference field, wich was Nullable, then i change it to Not Nullabe, Now during schema upgrade this:

exec sp_rename '[dbo].[DocumentOperation].[Entity_Id]', 'TempEntity_Id', 'COLUMN';
ALTER TABLE [dbo].[DocumentOperation] ADD [Entity_Id] uniqueidentifier DEFAULT '00000000-0000-0000-0000-000000000000' NOT NULL;
CREATE INDEX [DocumentOperation_FK_Entity] ON [dbo].[DocumentOperation] ([Entity_Id] ASC);
ALTER TABLE [dbo].[DocumentOperation] ADD CONSTRAINT [FK_DocumentOperation-Entity-DocEntity_Entity] FOREIGN KEY ([Entity_Id]) REFERENCES [dbo].[DocEntity] ([Id]);

This sql misses this statement:

UPDATE dbo.DocumentOperation SET Entity_Id = TempEnity_Id; Therefore the latter ALTER fails(Entity_Id is filled with zero guids)

Updated at 26.07.2010 6:28:27

This is the whole SQL text from the exception. I cannot reproduce this once more because I've fixed it manually

This thread was imported from our support forum. The original discussion may contain more detailed answer.

asked Jul 22 '10 at 11:19

xumix's gravatar image


I suspect there should be one more operation with "TempEntity_Id" column - could you check this, or send us the whole log / exception text?

(Jul 22 '10 at 11:19) Alex Yakunin Alex%20Yakunin's gravatar image

Hmm, clear. It really looks like a bug - we will try to reproduce it.

(Jul 22 '10 at 11:19) Alex Yakunin Alex%20Yakunin's gravatar image
Be the first one to answer this question!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview


Once you sign in you will be able to subscribe for any updates here



Asked: Jul 22 '10 at 11:19

Seen: 9,617 times

Last updated: Jul 22 '10 at 11:19

powered by OSQA