SQLTeam.com | Weblogs | Forums

Moving Data That Has Foreign Keys

Yes, @ScottPletcher -I was able to join to pull in the DependencyLevel.
This is an example of the results:
image

But, I'm not sure how to interpret this.
If I'm copying/inserting to tblAlertTypes, do I first have to populate tblActiveAlerts?
And the same question for tblBookingQuoteInfo - do I need to first insert tblBookingDocuments and tblBookingEstimateInfo? They're botj Level 2 so it doesn't matter which one I insert to first, correct?
Thankyou.

(1) Hmm, my results only had one table name. I believe those names would equate to the "ReferencedTable". Those table names must be loaded in dependency_level order, low to high.
(2) Correct. If the tables are at the same dependency_level, it does not matter which is loaded is loaded first. Put another way, tables at the same level may be loaded in any order.

Your function is very nice and part of my ready reference repertoire

Thanks