Red Gate forums :: View topic - Problem: SQL Compare tries to add existing column
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Compare 10
SQL Compare 10 forum

Problem: SQL Compare tries to add existing column

Search in SQL Compare 10 forum
Post new topic   Reply to topic
Jump to:  
Author Message
seannerd



Joined: 09 Feb 2012
Posts: 2

PostPosted: Thu Mar 15, 2012 1:27 pm    Post subject: Problem: SQL Compare tries to add existing column Reply with quote

SQL Compare 10.0.0.181 tries to add an existing column because the default constraint has a different name

In the script, I get these lines:
Code:
PRINT N'Altering [dbo].[updates]'
GO
ALTER TABLE [dbo].[updates] ADD
[settings] [int] NOT NULL CONSTRAINT [DF_updates_settings] DEFAULT ((0)),
[settings_r] [int] NOT NULL CONSTRAINT [DF_updates_settings_r] DEFAULT ((0))

But those two columns exist. Here is the compare screen shot of the difference before the script was generated:

And, to add to it, after errors occur, it tries to drop the columns a few lines later presumably because it thought the script was adding them.

I think, what should have happened here is:
Code:
alter table updates drop constraint DF__updates__Setting__405B5365
alter table updates add constraint DF_updates_settings default ((0)) for settings

alter table updates drop constraint DF__updates__Setting__414F779E
alter table updates add constraint DF_updates_settings_r default ((0)) for settings_r


Is this a bug, or am I running this with a bogus setting?

Thanks.

- Sean
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6582

PostPosted: Tue Mar 20, 2012 11:25 am    Post subject: Reply with quote

Without knowing the whole schema, it's hard to tell what's going on, but if you want to eliminate the possibility that SQL Compare is doing something because of the constraint names, you can eliminate that using the "ignore names of constraints and indexes" option.
Back to top
View user's profile Send private message
seannerd



Joined: 09 Feb 2012
Posts: 2

PostPosted: Tue Mar 20, 2012 4:23 pm    Post subject: Reply with quote

Yeah - I ended up using "ignore names" to get through it - though I sort of want the names. I can live without it.

I ran a test on a simple DB with one table, and SQL Compare did what I would expect, and dropped the original constraint, and re-added it with the new name.

So - I'm not sure what happened. But - I cannot mess with it anymore right now, unfortunately.

Thanks, Brian.

- Sean
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group