dbTalk Databases Forums  

String Concatenation

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss String Concatenation in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jim
 
Posts: n/a

Default String Concatenation - 07-25-2006 , 11:56 AM






I'm pretty new to SSIS, and I'd like to be pointed in the right direction to
achieve a problem I've hit a brick wall with. I would like to concatenate a
set of strings, but not across columns, but down a row - a String-Aggregation
like function - and create a new column with the output.

e.g
MyDataSet looks like
trip_number flight_from flight_to itinerary
1 'London' 'New York' ''
1 'New York' 'WashingtonDC' ''
2 'London' 'Zurich' ''

And I want to derive the following
1 'London' 'New York' 'London-New York / New York-Washington'
1 'New York' 'Washington' 'London-New York / New
York-Washington'
2 'London' 'Zurich' 'London-Zurich'

What would be the best way to achieve this?

Thanks in advance



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: String Concatenation - 07-25-2006 , 01:14 PM






What might work for you is is you have the same data on two inputs coming
into a merge join transform. You join on key columns.

If after that you need to do anything else you could use a derived column
transform.

Allan


"Jim" <Jim (AT) discussions (DOT) microsoft.com> wrote

Quote:
I'm pretty new to SSIS, and I'd like to be pointed in the right direction
to
achieve a problem I've hit a brick wall with. I would like to concatenate
a
set of strings, but not across columns, but down a row - a
String-Aggregation
like function - and create a new column with the output.

e.g
MyDataSet looks like
trip_number flight_from flight_to itinerary
1 'London' 'New York' ''
1 'New York' 'WashingtonDC' ''
2 'London' 'Zurich' ''

And I want to derive the following
1 'London' 'New York' 'London-New York / New York-Washington'
1 'New York' 'Washington' 'London-New York / New
York-Washington'
2 'London' 'Zurich' 'London-Zurich'

What would be the best way to achieve this?

Thanks in advance





Reply With Quote
  #3  
Old   
Jim
 
Posts: n/a

Default Re: String Concatenation - 07-26-2006 , 06:05 AM



Thanks Allan,

Can you explain exactly how it would work.

I think the join (trip_numer to trip_number in this case) will cartesian and
create a 5 records dataset. How would I then concatenate the
flight_from/flight_to columns and populate the itinerary field?

Cheers,

Jim
"Allan Mitchell" wrote:

Quote:
What might work for you is is you have the same data on two inputs coming
into a merge join transform. You join on key columns.

If after that you need to do anything else you could use a derived column
transform.

Allan


"Jim" <Jim (AT) discussions (DOT) microsoft.com> wrote in message
news:FE97ABCB-9D7B-4571-8209-F6D3D58BFDB5 (AT) microsoft (DOT) com...
I'm pretty new to SSIS, and I'd like to be pointed in the right direction
to
achieve a problem I've hit a brick wall with. I would like to concatenate
a
set of strings, but not across columns, but down a row - a
String-Aggregation
like function - and create a new column with the output.

e.g
MyDataSet looks like
trip_number flight_from flight_to itinerary
1 'London' 'New York' ''
1 'New York' 'WashingtonDC' ''
2 'London' 'Zurich' ''

And I want to derive the following
1 'London' 'New York' 'London-New York / New York-Washington'
1 'New York' 'Washington' 'London-New York / New
York-Washington'
2 'London' 'Zurich' 'London-Zurich'

What would be the best way to achieve this?

Thanks in advance






Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.