Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



Generally if I want to select the names starting with c I need to use c% But how could I code to..

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

Generally if I want to select the names starting with c I need to use c% But how could I code to..

Answer / bala

Use '%%' to select the data which contains %

Is This Answer Correct ?    7 Yes 5 No

Generally if I want to select the names starting with c I need to use c% But how could I code to..

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

Generally if I want to select the names starting with c I need to use c% But how could I code to..

Answer / prachi

SELECT NAME FROM EMP WHERE NAME LIKE 'C%';

Is This Answer Correct ?    1 Yes 1 No

Generally if I want to select the names starting with c I need to use c% But how could I code to..

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

Post New Answer

More DB2 Interview Questions

What is the latest version of ibm db2?

0 Answers  


How to resolve -803 sql code in DB2?

3 Answers   Cap Gemini,


what is the soft code for deadlock ?

2 Answers   Logica CMG,


What is a cursor and what is its function?

2 Answers  


How to retrieve rows from a db2 table in embedded sql?

0 Answers  


Is ibm db2 open source?

0 Answers  


What can the Locate option of the Repair Utility accomplish?

2 Answers  


What is schema in db2?

0 Answers  


Can you tell me how can you find out the # of rows updated after an update statement?

0 Answers  


What does DML stand for and what are some examples of it?

3 Answers   IBM,


How will fetch last 5 rows from table in db2

6 Answers  


What is index cardinality?

3 Answers  


Categories