Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SSIS-Data in multiple .csv files to columns in same csv file


SSIS-Data in multiple .csv files to columns in same csv file

Author
Message
avinash.818
avinash.818
SSC Rookie
SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)

Group: General Forum Members
Points: 39 Visits: 225
Hi Everyone
I have the below problem,could anyone please suggest me a solution.

file 1 has below data
1.csv

A
B
C

2.csv

E
F
G

the data in the output file should be

A E
B F
C G
the separator in output file can be tab or ,

could any one help?
Brandie Tarvin
Brandie Tarvin
SSCertifiable
SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)

Group: General Forum Members
Points: 7785 Visits: 8736
avinash.818 (4/25/2013)
Hi Everyone
I have the below problem,could anyone please suggest me a solution.

file 1 has below data
1.csv

A
B
C

2.csv

E
F
G

the data in the output file should be

A E
B F
C G
the separator in output file can be tab or ,

could any one help?


Use a Data Flow task with a MERGE connector to pull the files into the same data stream. Then output to a new file.

That's the best advice I can give you based on the information you've provided.

Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.
avinash.818
avinash.818
SSC Rookie
SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)

Group: General Forum Members
Points: 39 Visits: 225
Hi Brandie,

If I add a Merge Transform and Pull the Data into Destination,Data from each file Merges as one column in the output,what I need is a separate column for each file

This is my requirement. I have Several files each with One-Column and Several Rows
what I need is all the data is multiple files should go into one file with multiple columns
one column for one file.....can you suggest?
Koen Verbeeck
Koen Verbeeck
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16449 Visits: 13203
avinash.818 (5/6/2013)
Hi Brandie,

If I add a Merge Transform and Pull the Data into Destination,Data from each file Merges as one column in the output,what I need is a separate column for each file

This is my requirement. I have Several files each with One-Column and Several Rows
what I need is all the data is multiple files should go into one file with multiple columns
one column for one file.....can you suggest?


The problem here is you don't have an ID to join on, so you can't use the MERGE JOIN.
I think you'll need a script component as a transformation, where you read the two inputs and create one output row with two columns.



How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at SQLKover.

MCSA SQL Server 2012 - MCSE Business Intelligence
Mr. Kapsicum
Mr. Kapsicum
Right there with Babe
Right there with Babe (748 reputation)Right there with Babe (748 reputation)Right there with Babe (748 reputation)Right there with Babe (748 reputation)Right there with Babe (748 reputation)Right there with Babe (748 reputation)Right there with Babe (748 reputation)Right there with Babe (748 reputation)

Group: General Forum Members
Points: 748 Visits: 973
an identity column against each row would serve the purpose.....
you can use merge join then
Brandie Tarvin
Brandie Tarvin
SSCertifiable
SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)

Group: General Forum Members
Points: 7785 Visits: 8736
Koen Verbeeck (5/6/2013)
avinash.818 (5/6/2013)
Hi Brandie,

If I add a Merge Transform and Pull the Data into Destination,Data from each file Merges as one column in the output,what I need is a separate column for each file

This is my requirement. I have Several files each with One-Column and Several Rows
what I need is all the data is multiple files should go into one file with multiple columns
one column for one file.....can you suggest?


The problem here is you don't have an ID to join on, so you can't use the MERGE JOIN.
I think you'll need a script component as a transformation, where you read the two inputs and create one output row with two columns.


EDITING my response because I remembered what I meant originally.

Not a MERGE Transform. I misspoke. It should be a UNION ALL transform.

Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.
Koen Verbeeck
Koen Verbeeck
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16449 Visits: 13203
Brandie Tarvin (5/6/2013)
Koen Verbeeck (5/6/2013)
avinash.818 (5/6/2013)
Hi Brandie,

If I add a Merge Transform and Pull the Data into Destination,Data from each file Merges as one column in the output,what I need is a separate column for each file

This is my requirement. I have Several files each with One-Column and Several Rows
what I need is all the data is multiple files should go into one file with multiple columns
one column for one file.....can you suggest?


The problem here is you don't have an ID to join on, so you can't use the MERGE JOIN.
I think you'll need a script component as a transformation, where you read the two inputs and create one output row with two columns.


EDITING my response because I remembered what I meant originally.

Not a MERGE Transform. I misspoke. It should be a UNION ALL transform.


A UNION ALL is the same as the MERGE transform, but without the sorting.
It unions the data on a row basis, not a column basis (it's the same as in TSQL, you need to have the same columns).



How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at SQLKover.

MCSA SQL Server 2012 - MCSE Business Intelligence
Brandie Tarvin
Brandie Tarvin
SSCertifiable
SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)SSCertifiable (7.8K reputation)

Group: General Forum Members
Points: 7785 Visits: 8736
Koen Verbeeck (5/6/2013)
Brandie Tarvin (5/6/2013)
Koen Verbeeck (5/6/2013)
avinash.818 (5/6/2013)
Hi Brandie,

If I add a Merge Transform and Pull the Data into Destination,Data from each file Merges as one column in the output,what I need is a separate column for each file

This is my requirement. I have Several files each with One-Column and Several Rows
what I need is all the data is multiple files should go into one file with multiple columns
one column for one file.....can you suggest?


The problem here is you don't have an ID to join on, so you can't use the MERGE JOIN.
I think you'll need a script component as a transformation, where you read the two inputs and create one output row with two columns.


EDITING my response because I remembered what I meant originally.

Not a MERGE Transform. I misspoke. It should be a UNION ALL transform.


A UNION ALL is the same as the MERGE transform, but without the sorting.
It unions the data on a row basis, not a column basis (it's the same as in TSQL, you need to have the same columns).


Given what information the OP gave us, that's what he wants.

Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.
Koen Verbeeck
Koen Verbeeck
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16449 Visits: 13203
Brandie Tarvin (5/6/2013)

Given what information the OP gave us, that's what he wants.


File 1:
A
B
C

File 2:
E
F
G

Union All gives us:
A
B
C
E
F
G

Merge Join gives us:
A E
B F
C G



How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at SQLKover.

MCSA SQL Server 2012 - MCSE Business Intelligence
rajivkumar.bala
rajivkumar.bala
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 10
Hi Can you Generate AutoIdentity Number(adding new ID columne/through Script Component) for Each File Seperately.

Then Apply Merge Join , Based on ID Column(this helps Join on RowNumber Position)

example:

File1
Id Col
1 A
2 B
3 C

File 2
Id Col
1 D
2 E
3 F

Merge Join On File1.ID = File2.ID


So Final out put will be

ID File1.Col File2.Col
1 A D
2 B E
3 C F
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search