Need help with conditional split

  • Hi Guys,

    I got stuck with this requirement where in I have 4 columns in my source file.

    Lightwave 1250 West 2012-07-18

    Princeton9 250 East 2012-06-15

    Lewisville 645 Mid-west 2012-07-12

    Thats my source and I want to load the data to a flat file destination. However I want to get rid of rows whose column 1 values have a number in it. For example I want to error out the second row in the above data. I really appreciate any help. I was stuck here. thanks for your time.

  • This might be a little too complex for a conditional split.

    However, you can create a script component as a conditional split and use regular expressions to find out if the column contains a number.

    Using the Script Component as a Conditional Split

    check if string contains any numbers

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

  • Koen Verbeeck (7/24/2012)


    This might be a little too complex for a conditional split.

    However, you can create a script component as a conditional split and use regular expressions to find out if the column contains a number.

    Using the Script Component as a Conditional Split

    check if string contains any numbers

    Hi Koen,

    Can you please give me a sample code to work with. I am not a programmer so it will be hard for me to figure out. I know it is too much to ask, hope you understand.

  • Duplicate post. How about posting all future responses here.

  • you could use patindex to filter out if a column has a numerical value in it then dont return like so

    where PATINDEX('%[0-9]%',col1)=0

    ***The first step is always the hardest *******

  • And, please... no more double posts. It just splits up resources and answers. There are a lot of us that will look at all posts for a given day. Pick the correct forum and stick with it.

    --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 6 posts - 1 through 5 (of 5 total)

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