简体   繁体   中英

Exchange Rate Return

I am building a Monthly License Report for our IT department and it receives a list of License information in Euro's. I have an XML feed that provides Exchange rate data daily but the job will only be set to run once a month.

I have a conditional split set up in my SSIS package that splits off the USD exchange rate and discards everything else.

What I have left to do is to return only the exchange rate for the 1st of every month, I don't need every day just the day the report runs.

Is there an SSIS expression that will return only that line out of the XML feed? Or is there an SQL-T Script that will return only the first month data?

Date format is MM/DD/YYYY, I have a sequence of Derived columns that creates a [DateKey] for my [DIMDate] that is formatted as YYYYMMDD.

you have a dim date table?

select datekey
from dimdate
where day(datefield) = 1

That will give you the first day of every month that is in your dim date table. Inner join your existing select to this (inner join here will effectively function as a filter). Something along the lines of this

 inner join dimdate on dimdate.datefield = mainquery.datefield and day(dimdate.datefield) = 1

For the XML posted, this Xpath query will bring you the first element (group of currencies for the first date):

 '//Cube/Cube[1]/.' 

if you need to bring only the USD part then:

 '//Cube/Cube[1]/Cube[@currency="USD"]/.' 

In SSIS you can apply Xpath transformations through XML task in control flow.

I actually found a solution for this online that was a little simpler. I have built it, tested it and implemented.

I had to put my foot down with our Network guy and request an outside connection to the internet in order to make it happen (something he wasn't happy about doing) but once we worked that out it worked like a charm.

Here is the link to the site that I used.

http://technet.microsoft.com/en-us/sqlserver/ff686773.aspx

Thank you everyone for all the great ideas. I'm sure they will come in handy for other projects.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM