SQL Query to Split Concatenated Column data Into Multiple Rows

  • I have a column named Column_Value that has concatenated values such as 5y, 5u, 6h.  What I want to do is create one record for each one and copy all the other fields. 
    For instance a row may contain the following:

    KeyID  |   Column_Value |  Contract
    10011          |     5y, 5u, 6h       |   267823

    Will become

    KeyID  |   Column_Value |  Contract
    10011          |     5y                   |   267823
    10011          |     5u                   |   267823
    10011          |     6h                   |   267823Also, Column_Value may have one value, or many values.  So, I need to be able to determine if it has one value then do not split. If it has more than 1 then split into rows. 

    Thanks for your help!

  • Have a look at Jeff's DelimitedSplit8K Function.

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply