Red Gate forums :: View topic - Dropping Constraints and Indexes
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Comparison SDK Previous Versions
SQL Comparison SDK Previous Versions forum

Dropping Constraints and Indexes

Search in SQL Comparison SDK Previous Versions forum
Post new topic   Reply to topic
Jump to:  
Author Message
mtran



Joined: 07 Oct 2008
Posts: 25

PostPosted: Wed Jan 07, 2009 4:40 pm    Post subject: Dropping Constraints and Indexes Reply with quote

I am trying to sync records between two tables in two different databases but I keep getting the UNIQUE_VALIDATION error/ UNIQUE KEY constraint.

Code:

session.Options.SqlOptions = (SqlOptions)sqloptions;


sqloptions is an enum that passed in as
Code:

DBSqlOptions.DropConstraintsAndIndexes | DBSqlOptions.ReseedIdentity | DBSqlOptions.DisableKeys | DBSqlOptions.UseTransactions


DBSqlOptions is an enum of SqlOptions

Why is this not working?

Thanks
Back to top
View user's profile Send private message
Chris Auckland



Joined: 24 Oct 2006
Posts: 755
Location: Red Gate Software Ltd.

PostPosted: Tue Jan 13, 2009 1:49 pm    Post subject: Reply with quote

Thanks for your post.

Are you also setting the provider options? These are the options that will be used when generating the migration script. e.g.

provider.Options = session.Options;
_________________
Chris
Back to top
View user's profile Send private message Send e-mail
mtran



Joined: 07 Oct 2008
Posts: 25

PostPosted: Thu Jan 15, 2009 8:00 pm    Post subject: Reply with quote

Thanks! It works as expected now.
Back to top
View user's profile Send private message
mtran



Joined: 07 Oct 2008
Posts: 25

PostPosted: Fri Jan 16, 2009 4:54 pm    Post subject: Reply with quote

Still having trouble syncing data. This time it is a foreign key constraint. Here is the error:

Error : The constraint 'PK__TABLE1__2E31B632' is being referenced by table 'TABLE2', foreign key constraint 'FK_TABLE2_TABLE1'.
Could not drop constraint. See previous errors.

Code:
DBSqlOptions.DropConstraintsAndIndexes| DBSqlOptions.DisableKeys|DBSqlOptions.ReseedIdentity|DBSqlOptions.UseTransactions


I have set the provider.Options = session.Options. It is only syncing TABLE1, TABLE2 records are already identical.

Thanks
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