July 23, 2012 at 1:11 pm
I have 4 columns coming in my source file.
Lightwave 1920 West 2012-07-20
Princeton9 250 East 2012-07-18
lewisville 500 Mid-west 2012-06-25
canon dr8 650 West 2012-07-05
If my first column value has a number in it, I want those rows to be errored out and not send it to a destination file.
For example I want to error out second row because the value princeton9 has a number(9) in it.
So my destination file have rows 1 and 3 and my error output have 2 and 4.
I understand that I have to use conditional split but I couldnt figure out the expression to use.
Thanks for your time and any help would be appreciated.
July 24, 2012 at 8:55 am
I think you'll need to use a script component and .NET RegEx functionalisty to get this to work.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
July 24, 2012 at 10:26 am
Jack Corbett (7/24/2012)
I think you'll need to use a script component and .NET RegEx functionalisty to get this to work.
Do you know of any samples which I can leverage? I am not a programmer so it will be hard to get this done.
Any help would be appreciated. Thanks.
July 24, 2012 at 10:35 am
Are SQL Server tables involved at any point in this process? Or is this a file-to-file job?
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
July 24, 2012 at 10:43 am
I agree with Jack.
But I can envisage a revolting non-programming option.
Create a derived column which is a massive nested replace - to replace any of 0, 1, 2, ..., 9 with an empty string.
Then compare the length of this derived column with the length of the original string - if different, error.
Now I feel dirty! Regex is the elegant way 🙂
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
July 24, 2012 at 1:22 pm
excuse double post i replied to the other post before seeing the link
you could achieve your reslutls by using patindex
PATINDEX('%[0-9]%',col1)=0
if there is a value between 0 and 9 in col1 then these rows will be discounted from the result set
***The first step is always the hardest *******
July 24, 2012 at 4:58 pm
SGT_squeequal (7/24/2012)
excuse double post i replied to the other post before seeing the linkyou could achieve your reslutls by using patindex
PATINDEX('%[0-9]%',col1)=0
if there is a value between 0 and 9 in col1 then these rows will be discounted from the result set
+1
--Jeff Moden
Change is inevitable... Change for the better is not.
July 24, 2012 at 5:30 pm
Jeff Moden (7/24/2012)
SGT_squeequal (7/24/2012)
excuse double post i replied to the other post before seeing the linkyou could achieve your reslutls by using patindex
PATINDEX('%[0-9]%',col1)=0
if there is a value between 0 and 9 in col1 then these rows will be discounted from the result set
+1
There is no patindex function in SSIS.
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
July 25, 2012 at 1:26 am
i had not noticed this was for SSIS :w00t:
***The first step is always the hardest *******
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply