dbTalk Databases Forums  

Lookup against 2 columns

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Lookup against 2 columns in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jyork
 
Posts: n/a

Default Lookup against 2 columns - 08-24-2004 , 08:38 AM






Good morning-

I am trying to accomplish the following. In my lookup,
I need to find a value in a column(Store) when either the
Store_Code or Store_Code_Orig column value match the
variable passed through the lookup. I have this and it
works for one:


SELECT STORE
FROM K_Collect_Code
WHERE (Store_Code = ?)

but I need to have it use the Store_Code_Orig column as
well. Here is the transform incase that helps.

Function Main()
dim CM_ID
dim Store_Code
Store_Code = (DTSLookups("Store_Code").Execute
(DTSSource("Col018").Value))
CM_ID = Store_Code + DTSSource("Col009")
DTSDestination("CM_ID") = CM_ID
Main = DTSTransformStat_OK
End Function

Thanks for any help!!

Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: Lookup against 2 columns - 08-24-2004 , 01:40 PM






In message <bff701c489df$96bf7aa0$a501280a (AT) phx (DOT) gbl>, jyork
<anonymous (AT) discussions (DOT) microsoft.com> writes
Quote:
Good morning-

I am trying to accomplish the following. In my lookup,
I need to find a value in a column(Store) when either the
Store_Code or Store_Code_Orig column value match the
variable passed through the lookup. I have this and it
works for one:


SELECT STORE
FROM K_Collect_Code
WHERE (Store_Code = ?)

but I need to have it use the Store_Code_Orig column as
well. Here is the transform incase that helps.

Function Main()
dim CM_ID
dim Store_Code
Store_Code = (DTSLookups("Store_Code").Execute
(DTSSource("Col018").Value))
CM_ID = Store_Code + DTSSource("Col009")
DTSDestination("CM_ID") = CM_ID
Main = DTSTransformStat_OK
End Function

Try-

SELECT STORE
FROM K_Collect_Code
WHERE (Store_Code = ? OR Store_Code_Orig = ?)


Function Main()
dim CM_ID
dim Store_Code
Store_Code = DTSLookups("Store_Code").Execute
(DTSSource("Col018").Value, DTSSource("???").Value)
CM_ID = Store_Code + DTSSource("Col009")
DTSDestination("CM_ID") = CM_ID
Main = DTSTransformStat_OK
End Function



http://www.databasejournal.com/featu...le.php/1459171

--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.