splitting the values of column

  • I have the following data in my table

    number name city value

    1 aaa bbb ccc;ddd;lll;mmmm;

    2 xxxyyyzzz;lll;nn;

    3 mmmnnn666;

    I wanted to split the above data like the following.

    number name city value

    1 aaabbbccc

    1 aaabbbddd

    1 aaabbblll

    1 aaabbbmmm

    2xxxyyyzzz

    2xxxyyylll

    2xxxyyynn

    3mmmnnn666

    How can I do this?

    Thanks in advance.

  • You might want to search for "split string function" on this site.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • Please read the following article on "Tally" tables... it explains how to do it for a whole table like that and it also explains why it works.

    http://www.sqlservercentral.com/articles/T-SQL/62867/

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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