![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
One of our source files has duplicate records which generate a primary key constraint violation during the insert. We tried performing a lookup as part of the transformation, specifying the same connection as the destination. If the primary key exists in the table prior to the import, the import works correctly. If there are two new records, A & B with the same primary key, the batch fails on B because the lookup doesn't appear to detect that A has already been inserted in this batch. Shoul this idea work, or is the lookup really happening on a separate connection? Function Main() Dim id id = DTSLookups("GetDesc").Execute(DTSSource("col001")) If Not IsEmpty(id) Then Main = DTSTransformStat_SkipRow Else DTSDestination("numfield1") = DTSSource("col001") DTSDestination("varfield2") = DTSSource("col002") DTSDestination("numfield3") = DTSSource("col003") DTSDestination("varfield4") = DTSSource("col004") Main = DTSTransformStat_OK End If End Function SELECT numfield1 FROM DTSTEST WHERE (numfield1 = ?) |
#3
| |||
| |||
|
|
One of our source files has duplicate records which generate a primary key constraint violation during the insert. We tried performing a lookup as part of the transformation, specifying the same connection as the destination. If the primary key exists in the table prior to the import, the import works correctly. If there are two new records, A & B with the same primary key, the batch fails on B because the lookup doesn't appear to detect that A has already been inserted in this batch. Shoul this idea work, or is the lookup really happening on a separate connection? Function Main() Dim id id = DTSLookups("GetDesc").Execute(DTSSource("col001")) If Not IsEmpty(id) Then Main = DTSTransformStat_SkipRow Else DTSDestination("numfield1") = DTSSource("col001") DTSDestination("varfield2") = DTSSource("col002") DTSDestination("numfield3") = DTSSource("col003") DTSDestination("varfield4") = DTSSource("col004") Main = DTSTransformStat_OK End If End Function SELECT numfield1 FROM DTSTEST WHERE (numfield1 = ?) |
![]() |
| Thread Tools | |
| Display Modes | |
| |