Red Gate forums :: View topic - Data compare seems to compare tables out of order
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

Data compare seems to compare tables out of order

Search in SQL Comparison SDK Previous Versions forum
Post new topic   Reply to topic
Jump to:  
Author Message
mwatkins@xsinc.com



Joined: 01 Nov 2010
Posts: 3

PostPosted: Wed Jan 26, 2011 5:19 pm    Post subject: Data compare seems to compare tables out of order Reply with quote

Hello,

I have been working on something for some time now and struggling. We have our database deployments fully automated with Schema and Data comparisons but every once in a while we run into an issue where we get an UPDATE error on a Forign Key constraint. The error is as follows:

Exception of type System.Data.SqlClient.SqlException was thrown. Details:

The UPDATE statement conflicted with the FOREIGN KEY constraint "FK_Menu_Item_Page". The conflict occurred in database "DCP_Membership", table "dbo.Page", column 'Page_Key'.

This ocurrs becuase there was a record added to the Page table that the Menu_Item table references, however that Insert has not been executed yet. When debugging, I see that the order of tables that we get back from Red-Gate is out of order in how these records need to be updated.

Is there any way around this or am I missing something simple? Seems like this would be an issue for many here on the forum but I have not found anything regarding it.

Thanks,

Mike
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1123
Location: My desk.

PostPosted: Thu Jan 27, 2011 6:56 pm    Post subject: Reply with quote

Firstly, you should ensure that you've ticked the option "Disable Foreign Keys" - this will get data compare to disable all FK's before starting the process.
If you still find you encounter the error you may also have triggers that are fired on one of the inserts that tries to update something when it shouldn't, and again there are options to disable triggers within Data Compare.
Back to top
View user's profile Send private message
mwatkins@xsinc.com



Joined: 01 Nov 2010
Posts: 3

PostPosted: Mon Feb 07, 2011 8:04 pm    Post subject: Reply with quote

Hi James,

I am using the SDK for the sync process and from what the documentation says, the SqlOptions.DisableKeys is set. Is there another setting I should use in the SDK?

Thanks,

Mike
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