Link to home
Start Free TrialLog in
Avatar of DJMoonLight
DJMoonLight

asked on

DTS - Import file update/insert record

I am attemting to write a dts package that imports a file and if the record exists update the record and if it doesn't insert it.

I am using a data driven query..

Here is what i have:

Function Main()

Select case  DTSSOurce("col001")

case (DTSSource("col001") = DTSDestination("numID") )

      DTSDestination("numID") = DTSSource("Col001")
      DTSDestination("txtName").value = DTSSource("Col002").value
      Main = DTSTransformstat_UpdateQuery

case else
      DTSDestination("numID") = DTSSOURCE("col001")
      DTSDestination("txtName").value = DTSSOurce("Col002").value
      
      Main = DTSTransformstat_InsertQuery


end select


End Function

I am getting cannot insert duplicate records..

Do you see anything i am doing wrong?

thanks
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>you cannot do that with the DTS data flow in 1 step
well, even if one can/could, it's not recommendable, as it would check line by line. takes too much time