Solved

SSIS CSV to XML

Posted on 2014-03-27
1
227 Views
Last Modified: 2016-02-10
Hi,

I was wondering if the following is possible in SSIS and if someone could point me in the right direction...

Basically I would like to convert CSV files provided by customers into an XML file, how the position of the required columns in CSV may vary depending on customer.

For example we will require the following columns to be appended to the XML:

>> Account Code
>> Collection Date
>> Delivery Date
>> Product Code
>> Quantity

Customer A may send a file that has the following columns in order:

>> Collection Date
>> Delivery Date
>> Product Code
>> Quantity
>> Description
>> Type
>> Account

Customer B may send a file that has the following columns in order:

>> Product Code
>> Collection Date
>> Delivery Date
>> Account
>> Quantity
>> Description1
>> Description2

Is it possible to setup a mapping for each customer. For example a SQL table that looks like:
MappingTable.jpg
So the number in the table would show where the column is positioned in the customers text file.

I hope this makes sense...

Thanks, Greg
0
Comment
Question by:spen_lang
1 Comment
 
LVL 40

Accepted Solution

by:
lcohan earned 500 total points
ID: 39961928
Here's one way to do it outside SQL:

http://social.technet.microsoft.com/Forums/windowsserver/en-US/921bb5a8-c744-40de-899f-9121449ede83/merge-csv-files


In SQL you could use SSIS - Data Flow task with a MERGE connector (or UNION ALL transformation) to pull the files into the same data stream. Then output to a new file.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question