Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003
    Posts
    5

    Unanswered: Parse comma separated string into individual rows

    All,

    Can anyone help me in this task? I have a table named 'Activity' which has two columns: ActivityID and ActivityDetail. Sample rows look like this:

    ActivityID ActivityDetail
    1 'Football','Basket ball', Tennis'
    2 'Basket ball', 'Volley ball'

    I would like to have a stored procedure which parses the data into a new table (e.g. named as 'Activity_breadkdown' and with an identity column named 'DetailID') and looks like this:

    DetailID ActivityID ActivityDetail
    1 1 Football
    2 1 Basket ball
    3 1 Tennis
    4 2 Basket ball
    5 2 Volley ball

    Thanks in advance
    Al

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    You can modify the code posted in this thread...

    http://www.dbforums.com/t974750.html
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •