×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Converting a string with multiple lines into multiple rows with 1 line

Converting a string with multiple lines into multiple rows with 1 line

Converting a string with multiple lines into multiple rows with 1 line

(OP)
Hello!

I've just picking up SSIS but I've run into a problem where I want to do some non-standard string manipulation. I've got a data source with 2 columns. ID and data. The data column is a string but has multiple lines within it seperated by return characters.  I would like each line of data to have its own ID with the corrosponding ID.

It currently looks like this:

ID   Data
==========
1    Jack
     Jane
     Jill
----------
2    Adam
     Anita
     Anne
----------
3    Bill
     Betty


And I want it to look like this:
ID   Data
==========
1    Jack
----------
1    Jane
----------
1    Jill
----------
2    Adam
----------
2    Anita
----------
2    Anne
----------
3    Bill
----------
3    Betty


I think I need to use a script transform but I'm not really sure how to go about doing that. Any ideas?

RE: Converting a string with multiple lines into multiple rows with 1 line

Yes, you will need to do some scripting. The msdn forums have some really good mvp's that can point you in the right direction:

http://forums.microsoft.com/msdn/showforum.aspx?forumid=80&siteid=1

Meanwhile, here is an example of some data manipulation. Not exactly what you're looking for, but educational:

http://agilebi.com/cs/blogs/jwelch/archive/2007/05/08/handling-flat-files-with-varying-numbers-of-columns.aspx

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close