how to split list of values in a column into individual values in another column

  • hi

    Can any one tell me how to split data in one field.

    table:

    id autoincremented values

    name varchar(1000)

    table data::

    id name

    1 test,test1,testasd12,tetstse23,tarasada,,teststsetsest

    2 asdasd,asdasdasdg,sdgdfgdfg,sdfgdfgd,sdfgdfgdf,dfsgdf

    like that i have many values. i need to split name column individually

    i will create a temporary table i want to insert like

    i want to split based on id field.

    id name

    1 test

    1 test1

    1 testasd12

    1 tetstse23

    1 tarasada

    like that i want to insert. can any guide me on this one.

    thanks

    Rock..

  • Try this page

    http://www.sommarskog.se/arrays-in-sql-2005.html



    Clear Sky SQL
    My Blog[/url]

  • actually i have comma seperated values in a single record. one record constains many comma seperated values. i need to seperate each value, by using comma i need to get values.how can i get the values based on that one. i need to keep the values in a #table, from that i need to use these individual values in another a query.

    Dave: i am bit confused with that link. can me give me more information on this.

    Thank you very much for sharing

    Regards

    Rock...

  • The link Dave pointed you at is a broad overview on how to split a string.

    It actually covers most if not any basic techniques.

    The first link in the "Links for" list in my signature will show you one of the options (usually a pretty fast one).

    It will also require some time to go through and "get the concept"...

    But a tally table can help you with a lot more stuff than simply split a string....



    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]

  • yup, i got it

    Thank you very much Guys for your valuable support

    Regards

    Rock..

  • Glad we could help! 🙂



    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]

Viewing 6 posts - 1 through 5 (of 5 total)

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