Split Comma Seperate Column Problem

  • Koen Verbeeck (3/17/2011)


    Jeff, stop interfering in SSIS threads. 😛 😀

    Ahhh!!! Be nice to Jeff, he can't help it if he is stuck in a T-SQL sandbox and can't come out to play 🙂

    Far away is close at hand in the images of elsewhere.
    Anon.

  • Phil Parkin (3/17/2011)


    Yes, SSIS still uses this archaic form of not equals

    Not that archaic ... so does C#.NET 🙂

    Ewwww... VB ftw!


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • David Burrows (3/17/2011)


    Koen Verbeeck (3/17/2011)


    Jeff, stop interfering in SSIS threads. 😛 😀

    Ahhh!!! Be nice to Jeff, he can't help it if he is stuck in a T-SQL sandbox and can't come out to play 🙂

    Heh... I've even been accused of being a Luddite. I'm not, really... I write stored procedures for stuff that SSIS can't do all the time. 😀

    --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)
    Intro to Tally Tables and Functions

  • Jeff Moden (3/17/2011)


    David Burrows (3/17/2011)


    Koen Verbeeck (3/17/2011)


    Jeff, stop interfering in SSIS threads. 😛 😀

    Ahhh!!! Be nice to Jeff, he can't help it if he is stuck in a T-SQL sandbox and can't come out to play 🙂

    Heh... I've even been accused of being a Luddite. I'm not, really... I write stored procedures for stuff that SSIS can't do all the time. 😀

    Ah, but Jeff, there is one thing SSIS can do that T-SQL can't.... RBAR efficiently. :w00t:


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • 😛

    --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)
    Intro to Tally Tables and Functions

  • Thanks all of you guys, I just want to give you update, i got the expression may be some one wanna to here it is, In derived column you can create new Column and paste these expression.

    Col 1 --> SUBSTRING(Description,1,FINDSTRING((ISNULL(Description) ? "" : Description),",",1) == 0 ? LEN(Description) : FINDSTRING((ISNULL(Description) ? "" : Description),",",1) - 1)

    Col 2 --> FINDSTRING(Description,",",1) == 0 ? NULL(DT_WSTR,4) : SUBSTRING(Description,FINDSTRING(ISNULL(Description) ? "" : Description,",",1) + 1,FINDSTRING((ISNULL(Description) ? "" : Description),",",2) == 0 ? LEN(Description) : FINDSTRING((ISNULL(Description) ? "" : Description),",",2) - 1 - FINDSTRING((ISNULL(Description) ? "" : Description),",",1))

    Col 3 --> FINDSTRING(Description,",",2) == 0 ? NULL(DT_WSTR,4) : SUBSTRING(Description,FINDSTRING(ISNULL(Description) ? "" : Description,",",2) + 1,FINDSTRING((ISNULL(Description) ? "" : Description),",",3) == 0 ? LEN(Description) : FINDSTRING((ISNULL(Description) ? "" : Description),",",3) - 1 - FINDSTRING((ISNULL(Description) ? "" : Description),",",2))

    Col 4 --> FINDSTRING(Description,",",3) == 0 ? NULL(DT_WSTR,4) : SUBSTRING(Description,FINDSTRING(ISNULL(Description) ? "" : Description,",",3) + 1,FINDSTRING((ISNULL(Description) ? "" : Description),",",4) == 0 ? LEN(Description) : FINDSTRING((ISNULL(Description) ? "" : Description),",",4) - 1 - FINDSTRING((ISNULL(Description) ? "" : Description),",",3))

  • Allright, glad that you found the solution. Thanks for posting back!

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

  • I'll bet you're hoping that the input file won't get a load of extra columns added any time soon!

    Too bad we can't write user-defined functions in the derived column editor - this would be a prime candidate.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 8 posts - 16 through 22 (of 22 total)

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