I have a relational database in which I'd like to copy a subset of hierarchical data from one database to another. I've found lots of information about moving or copying single tables with all sorts of transformations, but not a lot on basic hierarchical moving.
I have three questions about doing this in SSIS.
- Will uniqueidentifier IDs make this job easier than auto incremented integer IDs?
- How do I copy a basic Parent/Child in SSIS?
- How do I copy a a more complex Parent/Child/Parent2?
Question 1: Uniqueidentifier IDs
One solution to a question about moving data described creating clever staging tables to create new IDs. This led me to think that SQL UniqueID has an advantage over integer auto increment ID, since one can simply set "Keep Identity" without collision concerns. Is this true?
Question 2: Moving a basic hierarchy
Here's a simplified schema of my database (Parent<-Child):
OptimizationSets<-AllocationLimits
Assets<-AllocationLimits
Assets<-Returns
I'd like to choose some rows from the OptimizationSets table to copy from one database to another. In addition, I'd like to copy the corresponding child rows in AllocationLimits. I can use the OLE DB source to select the desired parent rows easily, but selecting the child rows doesn't seem obvious. The lookup function only returns one child row rather than all of them.
Question 3: Complex relationships
In addition to the selected rows in AllocationLimits, I'd like to copy the related parent rows in Assets, as well as the related returns.