Dropping Constraints and Indexes

Automate and integrate using the SQL comparison API

Moderator: Chris Auckland

Dropping Constraints and Indexes

Postby mtran » Wed Jan 07, 2009 4:40 pm

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: Select all
session.Options.SqlOptions = (SqlOptions)sqloptions;


sqloptions is an enum that passed in as
Code: Select all
DBSqlOptions.DropConstraintsAndIndexes | DBSqlOptions.ReseedIdentity | DBSqlOptions.DisableKeys | DBSqlOptions.UseTransactions


DBSqlOptions is an enum of SqlOptions

Why is this not working?

Thanks
mtran
 
Posts: 25
Joined: Tue Oct 07, 2008 6:55 pm

Postby Chris Auckland » Tue Jan 13, 2009 1:49 pm

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
Chris Auckland
 
Posts: 757
Joined: Tue Oct 24, 2006 2:12 pm
Location: Red Gate Software Ltd.

Postby mtran » Thu Jan 15, 2009 8:00 pm

Thanks! It works as expected now.
mtran
 
Posts: 25
Joined: Tue Oct 07, 2008 6:55 pm

Postby mtran » Fri Jan 16, 2009 4:54 pm

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: Select all
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
mtran
 
Posts: 25
Joined: Tue Oct 07, 2008 6:55 pm


Return to SQL Comparison SDK Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests