Merge 2 DB -
09-14-2005
, 08:25 PM
I need to merge 2 databases to 1. This will take some time, and I'm
making a DTS package for it.
Now I have 2 tables, Rooms and Departments. A room belongs to a
department and thus has a foreign key to it.
I first take the max ID of the department table of the destination DB,
put this in a variable and then insert all the departments of the
source in the destination (and I add the max variable to the ID).
Function Main()
DTSDestination("DE_ID") = DTSSource("DE_ID") +
DTSGlobalVariables("DEPARTMENT").Value
Main = DTSTransformStat_OK
End Function
This gives no problems.
Now when I'm inserting the rooms I also created a activeX for the
foreign key of the department:
Function Main()
DTSDestination("RO_DEID") = DTSSource("RO_DEID") +
DTSGlobalVariables("DEPARTMENT").Value
Main = DTSTransformStat_OK
End Function
So this should match the new value of the department right? Well when
executing the package I get an foreign key constraint error that job.
I have set workflow correctly. Am I missing something?
Thanks in advance,
Stijn Verrept. |