Solved

SSIS CSV to XML

Posted on 2014-03-27
1
225 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 39

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Here's a requirements document template for an integration project (also known as Extract-Transform-Load or ETL) based on my development experience as an SQL Server Information Services (SSIS) developer over the years.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
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…

813 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now