Hi,
I want to express LIKE or NOT LIKE in DataStage. For example I have an SQL statement like this:
select * from Y where X like 'Chels%'
select * from Y where X like '%Arsen%'
select * from Y where X not like '%ManU%'
How will this be represented in DS?
I thought of using MATCH(es)...
I want the where clause in the above SQL statement to be used in the transformer constraint condition...that is the first one would be:
X Matches 'Chels...' ( is it correct? )
the second:
X matches '...Arsen...' (is it correct?)
how would I represent the NOT LIKE though?
Regards,
EXPRESS LIKE or NOT LIKE EXPRESSION
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 17
- Joined: Mon Jan 16, 2006 2:11 pm
- Contact:
EXPRESS LIKE or NOT LIKE EXPRESSION
ARSENAL GUNNERS GOONER
Simple enough to test in a routine, yes? I believe you've got the syntax correct but for whatever reason I don't use that function all that much. Easy enough to test, however.
The online help should say if there is specific 'not' syntax. If there isn't, you can always use the 'Not' function to reverse the value of any expression.
The online help should say if there is specific 'not' syntax. If there isn't, you can always use the 'Not' function to reverse the value of any expression.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Pattern matching in server jobs uses neither SQL wildcards, which your examples use, nor regular expressions. Instead they have their own idiosyncratic patterns, which you can read about in the DataStage BASIC manual. To get you started, the "any" wildcard is either "0X" or "..." and the single character wildcard is "1X". You can specify that particular characters in the pattern must be alphabetic or numeric.
Thus X Matches "Chel..." will pick up Chelsea and Cheltenham, X Matches "...Arsen..." will be correct as well. Simply wrap a Matches operator in a Not() function to reverse its effect, for example Not(X Matches "...ManU...")
The pattern can be preceded by a tilde to reverse its effect, for example X Matches "~...ManU..." returns true for any X that does not contain "ManU".
Thus X Matches "Chel..." will pick up Chelsea and Cheltenham, X Matches "...Arsen..." will be correct as well. Simply wrap a Matches operator in a Not() function to reverse its effect, for example Not(X Matches "...ManU...")
The pattern can be preceded by a tilde to reverse its effect, for example X Matches "~...ManU..." returns true for any X that does not contain "ManU".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.