View previous topic :: View next topic
|
Author |
Message |
MGayathri
New User
Joined: 19 May 2007 Posts: 25 Location: Chennai
|
|
|
|
How to retrieve records having % in a field using DB2 Like parameter
Example:
PCT
10%
100%
20 |
|
Back to top |
|
|
muthuvel
Active User
Joined: 29 Nov 2005 Posts: 217 Location: Canada
|
|
|
|
To search for a % or an _ as a literal part of your string, use the ESCAPE clause
Example-
Code: |
SELECT EMPNO, EMPNAME, WORKDEPT FROM EMP WHERE EMPNAME LIKE ‘ANURAG+_KAPOOR%'
ESCAPE ‘+’ |
|
|
Back to top |
|
|
shankar.v
Active User
Joined: 25 Jun 2007 Posts: 196 Location: Bangalore
|
|
|
|
MGayathri,
I think your requirement is to retrieve the records that have character "%" in any position in the column data.
If yes, please check with the following code for your requirement as muthuvel suggested.
Code: |
SELECT COLUMN_NAME FROM TABLE_NAME WHERE COLUMN_NAME LIKE '%+%%' ESCAPE '+' |
|
|
Back to top |
|
|
MGayathri
New User
Joined: 19 May 2007 Posts: 25 Location: Chennai
|
|
|
|
Muthuvel and Shanker.. Thanks a lot.. |
|
Back to top |
|
|
|