Reputation: 699
I want to Select only those records of table TEST, having TEMPPATH value ends with IN ('XGENCISB.CPY', 'XCISTABT.CPY').
NOTE: These IN clause values will be set at run time
Please tell if this possible in a single query using sub-string??
Thanks in advance.
Upvotes: 0
Views: 1962
Reputation: 85
This is the solution of the CASES you asked from @Neji:
select * from TEST where lower(TEMPPATH) LIKE (lower('%.cpy'));
Upvotes: 1
Reputation: 14361
Try this too: With Right
and upper
:
select * from TEST where upper(Right(TEMPPATH,4)) = '.CPY'
AND TEMPPATH IS NOT NULL;
regexp
, take a look at this as well: Regular Expressions in DB2 SQLGiven that theset two string will be in the same length(12 or adjust accordingly), you can try
select * from TEST where upper(Right(TEMPPATH,12))
IN ('XGENCISB.CPY', 'XCISTABT.CPY')
AND TEMPPATH IS NOT NULL;
Upvotes: 1
Reputation: 6839
select * from TEST where TEMPPATH LIKE '%.CPY' OR TEMPPATH LIKE '%.cpy'
Upvotes: 1