0

Hi all,
Just wanted to start a discussion on a database issue that I am presented with; the issue is that I am trying to insert seed data into around 90 tables without having to worry about manipulating/disabling the foreign key constraints.

The most logical solution would be to do disable them during downtime or when the application has been brought down, insert the seed data and then re-enable the foreign keys. This solution will not work since say the application needs to be up and online while the inserts/updates are happening.

My intial thought was to use the 'sys.foreign_keys' command and store those into a temp table and thus the reference the data relationships when the inserts are executing. Is this a viable option .. or are there any better/more efficent solutions out there?

Thx :)

2
Contributors
1
Reply
29
Views
2 Years
Discussion Span
Last Post by urtrivedi
0

You need to prepare your script according to the dependencies. If you can sequence insertion script properly, no problem you will face. You need to study all foreign keys and based on that design which table insert will go first and so on till last table.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.