Pullind data from between commas

  • hi

    i have the following code i was trying to use to pull the data from after the second comma but it errosout.

    eg data 1,2,3,4,5,6

    what i am tryin to do is ull the 2 from the about sample data. then after that be able to pull the 3 4 5 etc.

    any deas where im going wrong

    SUBSTRING(CategoryCodeList,FINDSTRING(CategoryCodeList,",",1) - 1,FINDSTRING(CategoryCodeList,",",2) - LEN(CategoryCodeList))

    [\code]

  • Which version of SSIS are you using?

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • If you want to do it in SQL SERVER then Tally OH! An Improved SQL 8K “CSV Splitter” Function[/url]

    If you want to do in SSIS then check the following The Script Component as a Transformation

  • twin.devil (7/15/2016)


    If you want to do it in SQL SERVER then Tally OH! An Improved SQL 8K “CSV Splitter” Function[/url]

    If you want to do in SSIS then check the following The Script Component as a Transformation

    Unless it's SSIS 2012 or higher, in which case TOKEN takes care of it without any need for scripting ... assuming that the number of elements is constant, that is.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Phil Parkin (7/15/2016)


    twin.devil (7/15/2016)


    If you want to do it in SQL SERVER then Tally OH! An Improved SQL 8K “CSV Splitter” Function[/url]

    If you want to do in SSIS then check the following The Script Component as a Transformation

    Unless it's SSIS 2012 or higher, in which case TOKEN takes care of it without any need for scripting ... assuming that the number of elements is constant, that is.

    +1 Phil you are right only If OP is using SSIS2012, I have replied because question posted in SSIS 2005 section.

  • im using 2008

  • ronan.healy (7/15/2016)


    im using 2008

    you can try either of two option i have mentioned above.

  • twin.devil (7/15/2016)


    Phil Parkin (7/15/2016)


    twin.devil (7/15/2016)


    If you want to do it in SQL SERVER then Tally OH! An Improved SQL 8K “CSV Splitter” Function[/url]

    If you want to do in SSIS then check the following The Script Component as a Transformation

    Unless it's SSIS 2012 or higher, in which case TOKEN takes care of it without any need for scripting ... assuming that the number of elements is constant, that is.

    +1 Phil you are right only If OP is using SSIS2012, I have replied because question posted in SSIS 2005 section.

    You were right to do so. But as there are only two SSIS forums here on SSC (2005 and 'the rest'), people sometimes post in the wrong one.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

Viewing 8 posts - 1 through 7 (of 7 total)

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