Problem: SQL Compare tries to add existing column

Compares and synchronizes SQL Server databases, backups and scripts.

Moderators: JonathanWatts, Chris Auckland, David Atkinson, eddie davis, Anu Deshpande, Michelle Taylor, alice.easey, james.billings, chengvoon.tong

Problem: SQL Compare tries to add existing column

Postby seannerd » Thu Mar 15, 2012 1:27 pm

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: Select all
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:
Image
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: Select all
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
seannerd
 
Posts: 2
Joined: Thu Feb 09, 2012 9:00 pm

Postby Brian Donahue » Tue Mar 20, 2012 11:25 am

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.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Postby seannerd » Tue Mar 20, 2012 4:23 pm

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
seannerd
 
Posts: 2
Joined: Thu Feb 09, 2012 9:00 pm


Return to SQL Compare 10

Who is online

Users browsing this forum: No registered users and 1 guest