spliting columns data

  • hi friends,

    plese solve this and send my mail id =asranantha@gmail.com

    in ssis sourse file like id,name,sal

    1,abc,1000,350,8200,400

    i want out put like id,name,sal

    1,abc,1000

    1,abc,350

    1,abc,8200

    1,abc,400

    plese tell me how to solve this one plese tell me step by step process

  • Here's an article on that subject:

    http://www.sqlservercentral.com/articles/Tally+Table/72993/

    Here's another one:

    http://www.simple-talk.com/sql/t-sql-programming/the-helper-table-workbench/

    There are more if you search "split string in SQL" in Google/Bing/whatever.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • asranantha (7/14/2011)


    hi friends,

    plese solve this and send my mail id =asranantha@gmail.com

    in ssis sourse file like id,name,sal

    1,abc,1000,350,8200,400

    i want out put like id,name,sal

    1,abc,1000

    1,abc,350

    1,abc,8200

    1,abc,400

    plese tell me how to solve this one plese tell me step by step process

    If you really want to do the whole thing in SSIS, I think you might have to look into using an asynchronous script component, which is quite advanced.

    It's probably easier in T-SQL. Use the suggestion above, or import all the data into a staging table and then UNPIVOT to get the desired result.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Phil Parkin (7/14/2011)


    asranantha (7/14/2011)


    hi friends,

    plese solve this and send my mail id =asranantha@gmail.com

    in ssis sourse file like id,name,sal

    1,abc,1000,350,8200,400

    i want out put like id,name,sal

    1,abc,1000

    1,abc,350

    1,abc,8200

    1,abc,400

    plese tell me how to solve this one plese tell me step by step process

    If you really want to do the whole thing in SSIS, I think you might have to look into using an asynchronous script component, which is quite advanced.

    It's probably easier in T-SQL. Use the suggestion above, or import all the data into a staging table and then UNPIVOT to get the desired result.

    Won't the SSIS unpivot transformation do the trick?

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • :blush: I forgot there was one. Yep, that should work. Not sure how performance compares with Unpivot in T-SQL, so staging might still be best if there is lots of data...

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Phil Parkin (7/15/2011)


    :blush: I forgot there was one.

    Because it is Friday, I will forgive this one 😀 😎

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

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

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