Using Lookups in DTS

  • Hi All:

    I need to update two separate tables based on two separate source's. One a .txt file and the other a foreign key in a table.

    I've read that lookups may be helpful.. Trouble is I've seen very little in the way of detailed samples other than very simple examples.

    Any help would be much appreciated.

    thanks,

    JS

  • When you click on the Lookups tab in the transformation form, you can add a lookupname to the list of lookups. Select the datasource for this lookup and then click on the button on the right.

    This will take you to the Lookup query.

    Obviously, you will want to lookup a value by passing it a parameter. This you can do in the following way:

    Select Field from Table where Field1 = ?

    The question mark will allow you to pass the pass a value as the parameter ie:

    Var = DTSLookups("LookupName").execute (Value)

    Example:

    Ans = DTSLookups("GetNewName").execute ('Peter')

    -or-

    Ans = DTSLookups("GetNewName").execute ('Peter', 'Smith')

    In the second example, you are sending 2 parameters and therefor you need to have 2 parameters in the actual lookup query. eg:

    Select Field from Table where Field1 = ? and Field2 = ?

    Inside the lookups tab, you can test the lookup values by clicking on the test button on top.

    Graham

  • Hi,

    Here is something to start with

    http://www.sqldts.com/default.aspx?6,107,277,7,1

    Good way is to import all into a temp table and then update you main table, also it's better to have one connection for each source.

    JFB

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

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