Red Gate forums :: View topic - foreign keys to other unsynchronized tables
Return to www.red-gate.com RSS Feed Available

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

foreign keys to other unsynchronized tables

Search in SQL Packager Previous Versions forum
Post new topic   Reply to topic
Jump to:  
Author Message
albertvo



Joined: 06 Dec 2007
Posts: 2

PostPosted: Thu Dec 06, 2007 10:42 pm    Post subject: foreign keys to other unsynchronized tables Reply with quote

Can anyone give some insight into what this warning means?

The table [dbo].[MyTableName] has foreign keys to other unsynchronized tables, the database may be left in an inconsistent state.

This is a warning in the Data section of the script generated by SQL Packager.

Thanks
Albert
_________________
Albert Vo
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6677

PostPosted: Fri Dec 07, 2007 2:53 pm    Post subject: Reply with quote

Hi Albert,

Foreign keys exist to ensure that data is relationally consistent, so if for instance you have an FK relationship between a customer and a purchase table, it would prevent you from inserting a purchase before the customer record is created for the purchaser.

SQL Packager may temporarily drop this foreign key, allowing you to completely violate the referential integrity. Therefore if you synchronize the purchase table and then exclude the customer table from synchronization, the data consistency enforced by the foreign key in the database being synchronized to is completely lost.

The warning is advising you to make sure that you check that both tables in a foreign key relationship are synchronized so that the data is consistent between the two tables.
Back to top
View user's profile Send private message
albertvo



Joined: 06 Dec 2007
Posts: 2

PostPosted: Fri Dec 07, 2007 6:17 pm    Post subject: Thanks Reply with quote

Thanks for the quick reply. I guess I was thrown off by the word "unsynchonized" because i associated that with synchronizing two existing databases.
_________________
Albert Vo
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6677

PostPosted: Sun Dec 09, 2007 10:16 am    Post subject: Reply with quote

Hi Albert,

It's a side-effect of re-using SQL Data Compare's components in Packager. The dll has no concept of creating a database, only comparing two existing ones -- and in Packager's case it still does this: it synchronizes on database to another 'empty' database.

Nevertheless, the warning is still applicable to a new database package.
Back to top
View user's profile Send private message
rwyarger



Joined: 17 Dec 2007
Posts: 7

PostPosted: Mon Dec 17, 2007 8:57 pm    Post subject: Re: Reply with quote

Brian Donahue wrote:
Hi Albert,

It's a side-effect of re-using SQL Data Compare's components in Packager. The dll has no concept of creating a database, only comparing two existing ones -- and in Packager's case it still does this: it synchronizes on database to another 'empty' database.

Nevertheless, the warning is still applicable to a new database package.


Hello Brian -

I too have run into this problem, and have seen it whether or not I have my foreign keys enabled or disabled by the tool (prior to making the schema and data files).

I currently have about a 43mb data file along with a 1.5mb schema, and have not been able to recreate my database with either the option to create a .NET exe, nor with the SQL Management Studio, nor from the command line with sqlcmd.

Is there something missing here? I've attempted about a half dozen creations of the 2 files now, and regardless - I still am unable to recreate my database.
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6677

PostPosted: Tue Dec 18, 2007 11:42 am    Post subject: Reply with quote

Hi,

Sorry, I don't understand. This warning message should not prevent you from being able to create a database. Is this a different problem entirely?
Back to top
View user's profile Send private message
rwyarger



Joined: 17 Dec 2007
Posts: 7

PostPosted: Tue Dec 18, 2007 3:28 pm    Post subject: Re: Reply with quote

Brian Donahue wrote:
Hi,

Sorry, I don't understand. This warning message should not prevent you from being able to create a database. Is this a different problem entirely?



I think I may need a different set of your tools to do what it is I need to do.

It seems that SQL Packager is not going to fit the bill for my needs (because of circular dependencies between tables).

Thus - I am going to check out SQL Compare and SQL Data Compare for the version control and db reconstruction that my company needs to do.

Thanks and sorry for all the posts on this.
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