Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005
    Posts
    165

    Unanswered: Converting a comma-separated list to new rows...

    Hi. I have a table that was not setup correctly. One of the columns contains data separated by a comma. What I would like to do is split the data into new rows to be inserted into a new table. Here's what I'm talking about:

    Code:
    ID  |  DefenseMotions
    ----+---------------------
    165 | 15,65,88,12,56
    167 | 15,26,58,46
    And I want to put the data in the DefenseMotions table into a new table:

    Code:
    ID  | MotionID
    ----+-------------
    165 | 15
    165 | 65
    165 | 88
    165 | 12
    165 | 56
    ...
    Is this possible? I'm using SQL Server 2005. Thanks!

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

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