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)
 Executes fine, but no data update

Author  Topic 

slugfest
Starting Member

18 Posts

Posted - 2004-08-31 : 13:00:49
I am importing data from a text file and inserting/updating it in a database table. The package executes successfully, but the data does not update. Here are my pieces...

Text Source
------------
UID
Name

TestData Table
---------------
UID
Name

Look up
---------------
SELECT UID
FROM TestData
WHERE (UID = ?)

Insert Query
---------------
INSERT INTO TestData (UID, Name)
VALUES (?, ?)

Update Query
---------------
UPDATE TestData
SET OfficeName = ?
WHERE (UID = ?)


Transformation
---------------

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
   

- Advertisement -