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 |
How to check last update on table in db2?
What is dbrm? What it contains? When it will be created?
What is meant by dclgen?
What are the contents of a DCLGEN?
What does sqlcabc has?
how to resolve -811 sqlcode .give clear explaination
What is the result of open cursor statement?
Comment whether dclgen is mandatorily used. If not, then what is the point of using it?
How do I delete a table in database?
What types of tables are there in the db2 database?
what are the max. & min. no. of partitions allowed in a partition tablespace?
what is the certification that has a good value for a practioner in mainframes but not habving much knowledge on db2 related stuff?