Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Problem updating data

Author  Topic 

slugfest
Starting Member

18 Posts

Posted - 2004-09-01 : 10:35:59
I'm bringing data from a text file into a database table. I want to INSERT the new records and UPDATE any existing. The insertion works fine, but the update is not happening. Is there anything wrong with this function?


Function Main()

' --- set up the columns to transform
DTSDestination("UID") = DTSSource("UID")
DTSDestination("Name") = DTSSource("Name")

If DTSLookups("UIDlookup").Execute(DTSSource("UID")) <> "" Then
' --- employee record exists, so update it
Main = DTSTransformstat_UpdateQuery
Else
' --- record doesn't exist, so insert it
Main = DTSTransformstat_InsertQuery
End If

End Function



Here's my Lookup:

SELECT UID
FROM TestData
WHERE (UID = ?)

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-09-01 : 20:09:10
Don't you need to issue a
Main = DTSTransformstat_OK

to commit the changes?

Go to Top of Page

slugfest
Starting Member

18 Posts

Posted - 2004-09-02 : 12:35:06
Not sure, Timmy.

Where would that fall in the function?
Go to Top of Page
   

- Advertisement -