DTS duplicate inserts

  • I have written a DTS package with the following code in it:

    If Not IsEmpty(intPRMC) Then

     DTSDestination("DateExpires") = DTSSource("expirationdate")

     DTSDestination("OverallResultID") = intStatus

     DTSDestination("Notes") = DTSDestination("Notes") & " HSC Update " & CDate(Now)

     DTSDestination("DateClosed") = DTSSource("approval_date")

     DTSDestination("ReviewID") = DTSLookups("ReviewID").Execute(Left( DTSSource("ReviewType"), 4))

     DTSDestination("PRMCID") = intPRMC

     

     Main = DTSTransformStat_UpdateQuery

    Else

     DTSDestination("TypeID") = intType

     DTSDestination("ReviewID") = DTSLookups("ReviewID").Execute(Left( DTSSource("ReviewType"), 4))

     DTSDestination("DateSubmitted") = DTSSource("event_date")

     DTSDestination("DateClosed") = DTSSource("approval_date")

     DTSDestination("Notes") = "HSC Import " & CDate(Now)

     DTSDestination("OverallResultID") = intStatus

     DTSDestination("DateExpires") = DTSSource("expirationdate")

     DTSDestination("ProtocolID") = intProt

     Main = DTSTransformStat_InsertQuery

    End If

    The update part works wonderfully.  Whenever it runs an insert it does it twice so I end up with 2 records when there was only one in the source data.  Does anyone have ANY idea what I have done wrong here or how I can make this not happen in the future?

    Thank you SO much for your assistance.

    Eva

  • Hi Eva,

    Sounds like this script is actually being executed twice - cuz if you update twice you see one update.  If you insert twice, you see two inserts.  Stick a msgbox in your else block and test that theory, okay?

    [font="Courier New"]ZenDada[/font]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply