Why isnt my lookup working?

  • I'm doing my first LookUp in a simple DTS transformation.

    Here's my lookup:

    SELECT MetroIndex

    FROM Metro

    WHERE (MetroCode = '?')

    Here's my Transformation:

    Function Main()

    DTSDestination("OrgID") = DTSSource("OrgID")

    DTSDestination("MetroIndex") =

    Cint(DTSLookups("lkp_MetroIndex").Execute(DTSSource("MetroCode")))

    Main = DTSTransformStat_OK

    End Function

    When I test the transformation, it runs without errors, but it gives me

    results like this:

    MetroIndex OrgID

    0 abq100001

    0 ...

    0 ...

    The lookup should be providing an integer other than 0 for the

    MetroCodes I am feeding it. The first line has a MetroCode of 'abq',

    and when I feed that into the LookUp instead of the question mark (?),

    it returns MetroIndex 209. So why is my lookup returning 0 in my

    transformation? Am I referring to it incorrectly? I tried changing the

    line with the lookup to this:

    Dim arrMetro

    arrMetro =

    DTSLookups("lkp_MetroIndex").Execute(DTSSource("MetroCode"))

    DTSDestination("MetroIndex") = arrMetro(0)

    ...like the example on sqldts.com, but it gives me a RunTime error,

    "Type mismatch: arrMetro" on the last line.

    Anybody see what I'm doing wrong?

     

     

  • This was removed by the editor as SPAM

  • You need to reference to parmeter in your lookup as ? that is without apostroph '

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

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