Generally if I want to select the names starting with c I
need to use c%
But how could I code to select the data which contains %
as a part of data.
Answers were Sorted based on User's Feedback
Answer / mdvasanth86
Anand is right.
SELECT * FROM table_name WHERE column_name LIKE 'C!%'
ESCAPE'!';
If you want to use % or _ as part of your like clause,
you must have an escape character before each occurrence of
% or _ and define what the escape character is like above.
So, an escape character before the % or _ will make it part
of the string rather than a wildcard character(S).
HTH
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / guest
C% will work for all the cases. Even if the data contains
%, Using C% will fetch that too.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / anand
hi,
it may be correct ans.check out this..
SELECT * FROM table_name WHERE column_name LIKE 'C%%'
ESCAPE'%';
| Is This Answer Correct ? | 2 Yes | 3 No |
What is the latest version of ibm db2?
How to resolve -803 sql code in DB2?
what is the soft code for deadlock ?
What is a cursor and what is its function?
How to retrieve rows from a db2 table in embedded sql?
Is ibm db2 open source?
What can the Locate option of the Repair Utility accomplish?
What is schema in db2?
Can you tell me how can you find out the # of rows updated after an update statement?
What does DML stand for and what are some examples of it?
How will fetch last 5 rows from table in db2
What is index cardinality?