Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SSIS Lookup-Is this the best option? Expand / Collapse
Author
Message
Posted Friday, February 22, 2013 11:57 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, December 17, 2014 6:26 AM
Points: 97, Visits: 504
I am trying to make a change to my ssis data flow. The reality is that I'm stuck.
My data flow problem has to do with currency exchange. I realized that I needed to be able to convert Canadian dollars to US Dollars and I will need to reference an exchange rate table when the 'Currency Code' = 'CAD'(Canadian).

So I have a column in my data that holds the currency code which happens to be only US and CAD. What I'd like to do is;

when Currency code = 'CAD', have it look up the rate in the exchange rate table and append it to the exchange rate column.

I know the way I wrote it is a bit confusing but I figure it will at least start the dialogue. Is the lookup a good starting point?

Thanks
Post #1423203
Posted Friday, February 22, 2013 12:43 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 12:24 AM
Points: 5,317, Visits: 12,355
Sounds like a textbook use for the lookup transformation to me - go for it.

Do you have specific questions about how to set things up?



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.

It is better to keep your mouth shut and appear stupid than to open it and remove all doubt. (Mark Twain)
Post #1423223
Posted Friday, February 22, 2013 12:53 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, December 17, 2014 6:26 AM
Points: 97, Visits: 504
Thanks Phil,

I definitely have questions. It's late on Friday and my logic has gone out the window.

My questions are basically,

1.where do I put it within my data flow

Ex: My data flows goes like this;

1.Load Invoice and payment data
2. Sort Invoice and payment data
3. Join Invoice and Payment Data
4. Convert the Data
5. Set defaults and derived columns
6. Load in the Destination

2. My Invoice Data has the Currency Type.

IF the currency type = 'CAD' then I want to look at a View and append the Rate for the Matching date to the data befor it goes to the destination.

Hope this makes sense...and Thanks





Post #1423224
Posted Friday, February 22, 2013 12:59 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 12:24 AM
Points: 5,317, Visits: 12,355
Yeah that makes sense.

I don't think it matters much where you put it - maybe between (4) and (5) would work well.

Regarding the lookup itself - will there be an exact match in the exchange lookup table for every currency/date combination in the source data?



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.

It is better to keep your mouth shut and appear stupid than to open it and remove all doubt. (Mark Twain)
Post #1423226
Posted Friday, February 22, 2013 1:07 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, December 17, 2014 6:26 AM
Points: 97, Visits: 504
There will not be an exact (date match) in the exchange view. This is updated once per week.

What I was thinking about doing is adding a week and year number column to the source and the lookup view so I could match on that?

What confuses me the most is the logic for the lookup and how it works.

Any good starting points? (Besides dragging it on the canvas)
Post #1423231
Posted Friday, February 22, 2013 1:16 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 12:24 AM
Points: 5,317, Visits: 12,355
mbrady5 (2/22/2013)
There will not be an exact (date match) in the exchange view. This is updated once per week.

What I was thinking about doing is adding a week and year number column to the source and the lookup view so I could match on that?

What confuses me the most is the logic for the lookup and how it works.

Any good starting points? (Besides dragging it on the canvas)


There's no magic in it - all that you are doing is matching one or more columns in your source data to one or more in the lookup table (think of it as an inner join) - and then including any other columns (in your case exchange rate) from the lookup table in your data flow.

But it needs to be an exact match, one way or another. If it were me, I would probably use a date tally table to 'explode' the currency view to include all dates and then match against that.



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.

It is better to keep your mouth shut and appear stupid than to open it and remove all doubt. (Mark Twain)
Post #1423236
Posted Friday, February 22, 2013 1:19 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, December 17, 2014 6:26 AM
Points: 97, Visits: 504
I love the idea of a date tally table. Great idea. I will create one and hopefully that will be a great place to start.

Thanks a lot!!!!
Post #1423237
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse