The problem is I import data into relational tables where the source of the data is a XML-file + XSD schema. The XML source has several outputs and the relationships between nodes is created by SSIS in columns as order_id (generated primary key value not in XML) and in lets say order details we get the foreign key order_id.
The file gets imported and we have a correct referential integrity between lets say orders and order details but the key is only unique within each file so if same file is imported again the same id is generated/used by ssis.
How can you ensure uniqueness / control how the id is generated.
I have tried to use a identity column as order_id in the order table that works but then it does not propagate down to reference tables like order details...
Example if we have
<order some attributes ...>
<orderdetails some attributes ...></orderdetails>
<orderdetails some attributes ...></orderdetails>
</order>
if we just let ssis import the rows we will get something like :
order table
order_id = 4 , rest of data columns
orderdetails table
row 1 orderdetail columns , order_id=4 row 2 orderdetail columns , order_id=4
Everything ok but I don't understand how the apparently semi-random id = 4 is generated
If an incremental key is used I would get (assuming seed starts at 1)
order table
order_id = 1 , rest of data columns
orderdetails table
row 1 orderdetail columns , order_id=4 <--same as previously SSIS generated row 2 orderdetail columns , order_id=4 <--same as previously SSIS generated
I would like the id be 1 for the foreign key in details so I guess there is some intermediary step / setting I have missed in order to maintain referential integrity when importing XML data.
Any pointers would be highly appreciated.