DTS Lookup Query in DDQ Task Always Incorrectly Returns 0 -
03-04-2004
, 05:20 PM
My lookup query looks like:
SELECT COUNT(*) AS Expr1
FROM dbo.DestinationTable
WHERE (KeyField1 = ?)
AND (KeyField2 = ?)
AND (KeyField3 = ?)
AND (KeyField4 = ?)
My Transformation ActiveX script snippit:
....
RecExists = Trim(DTSLookups("lkpPreExistingRecs").Execute(
DTSSource("KeyField1").Value,
DTSSource("KeyField2").Value,
DTSSource("KeyField3").Value,
DTSSource("KeyField4").Value))
SELECT CASE RecExists
CASE 0
DTSDestination("Version") = 1
Main = DTSTransformstat_InsertQuery
CASE Else
DTSDestination("Version") = RecExists + 1
Main = DTSTransformstat_UpdateQuery
End Select
....
The problem is that "RecExists" is always a 0. My message box debug
statements confirm the correct inputs into the lookup query, and I
have verified that there are multiple rows for many of these
transformations (lookup query returns >0 value). I've also tried
using the VB Conversion routines in the "Execute" call w/o luck.
Any iders? |