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 |
OUTER JOINS USED TO GET MATCHING AND NONMATCHING ROWS FORM 2 OR MORE TABLES BASED ON COLUMNS. SIMPLE JOINS ALSO DO THE SAME THEN WHAT IS THE USE OF OUTER JOINS.
What is the difference between spufi and qmf?
What value the host varible will contain , if null indicator value is -2 ? Will it contain the truncated value or nothing will move ?
how to resolve -805 . how to see dbrm and package not found
What is dbrm? What it contains?
How can you split a table in to exactly half?
Request to database but database is not available so what is was abend is raised?
What are foreign keys in db2?
What is the difference between Where and Having Clause
How to check table size in db2 sap?
What is the meaning of -805 SQL return code?
What is a synonym ?