dbTalk Databases Forums  

Merge 2 DB

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Merge 2 DB in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Stijn Verrept
 
Posts: n/a

Default 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.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.