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 12»»

SSIS-Data in multiple .csv files to columns in same csv file Expand / Collapse
Author
Message
Posted Thursday, April 25, 2013 2:39 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: 2 days ago @ 11:15 AM
Points: 38, Visits: 183
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?
Post #1446354
Posted Thursday, April 25, 2013 6:23 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 8:24 AM
Points: 7,133, Visits: 6,295
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 Administrator

Webpage: http://www.BrandieTarvin.net
LiveJournal Blog: http://brandietarvin.livejournal.com/
On LinkedIn!, Google+, and Twitter.

Freelance Writer: Shadowrun
Latchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.
Post #1446451
Posted Monday, May 6, 2013 12:33 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: 2 days ago @ 11:15 AM
Points: 38, Visits: 183
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?
Post #1449593
Posted Monday, May 6, 2013 1:17 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 3:55 PM
Points: 13,357, Visits: 10,222
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 LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1449606
Posted Monday, May 6, 2013 1:56 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Today @ 1:41 AM
Points: 451, Visits: 578
an identity column against each row would serve the purpose.....
you can use merge join then
Post #1449617
Posted Monday, May 6, 2013 5:35 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 8:24 AM
Points: 7,133, Visits: 6,295
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 Administrator

Webpage: http://www.BrandieTarvin.net
LiveJournal Blog: http://brandietarvin.livejournal.com/
On LinkedIn!, Google+, and Twitter.

Freelance Writer: Shadowrun
Latchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.
Post #1449670
Posted Monday, May 6, 2013 6:27 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 3:55 PM
Points: 13,357, Visits: 10,222
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 LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1449688
Posted Monday, May 6, 2013 6:29 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 8:24 AM
Points: 7,133, Visits: 6,295
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 Administrator

Webpage: http://www.BrandieTarvin.net
LiveJournal Blog: http://brandietarvin.livejournal.com/
On LinkedIn!, Google+, and Twitter.

Freelance Writer: Shadowrun
Latchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.
Post #1449689
Posted Monday, May 6, 2013 7:41 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 3:55 PM
Points: 13,357, Visits: 10,222
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 LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1449718
Posted Tuesday, May 14, 2013 5:03 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, August 29, 2013 5:23 PM
Points: 3, Visits: 9
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


Post #1452881
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse