Foreign Key differences not included in SQL Scrip
chev265
Posts: 5
Hi, I am currently evaluating SQL Compare 6.2 and am having trouble with foreign keys.
I have a table called Budget that is listed in the 'objects that exist in both but are different' category. The only difference that is picked up is that the source database has an extra foreign key. This is as I expected. The problem is if I then run the Snych wizard (with this table included/checked) or look at the SQL for that particular object it only scripts out the following without any actual object changes (foreign keys and check constraints are not checked as being ignored in the project settings). The only other thing that may be a bit out of the ordinary is that all tables, included this one, are in their own schema not dbo under SQL 2005.
SET NUMERIC_ROUNDABORT OFF
GO
SET ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, ARITHABORT, QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
SET XACT_ABORT ON
GO
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
I have a table called Budget that is listed in the 'objects that exist in both but are different' category. The only difference that is picked up is that the source database has an extra foreign key. This is as I expected. The problem is if I then run the Snych wizard (with this table included/checked) or look at the SQL for that particular object it only scripts out the following without any actual object changes (foreign keys and check constraints are not checked as being ignored in the project settings). The only other thing that may be a bit out of the ordinary is that all tables, included this one, are in their own schema not dbo under SQL 2005.
SET NUMERIC_ROUNDABORT OFF
GO
SET ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, ARITHABORT, QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
SET XACT_ABORT ON
GO
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
GO
Comments
Redgate Software
Thanks for your reply. I have just been preparing the databases to send through to you and actually discovered the source of the problem. In the database where the foreign key exists (source) the foreign table is a table, but the destination database that table is actually a view hence the foreign key cannot actually be created! oops.
Is there a way to filter out those differences? I don't want to filter out all foreign constraint differences, only those that cannot be created.
Sorry for the trouble.
Thanks
James
Redgate Software
But, the thing is the script will fail anyway because there is already an object in the destination database with that name (the view). And the foreign keys cannot be created against a view as well so you end up with mutliple errors. I want it to completely ignore those foreign keys that cannot be scripted.
To get the feature request right: is what you're asking for an option which would only display as differences the kind of differences that can be synchronized without synchronizing any dependant objects? (i.e. only showing differences that can be synchronized with Include Dependancies off)?
Redgate Software
With regards to the feature request, you have it right. If that feature was implemented then that would do the trick and would in fact help me out a lot.
Thanks for all your help.