• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Taking entries from database containing %

 
Raj Kumar Bindal
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to take entries from database having % ,how to do that
I am doing:
select * from tablename where columnname like '%%'
but not working
How can i achieve that
 
Scott Selikoff
author
Saloon Keeper
Posts: 4020
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe it varies on the DBMS but since % is a special character, if you want to reference it as a literal you need to use something like \% (MySQL usage).

For example if you wanted to find all rows with a column that contains a %, the query would be:



Note the % before and after \% for wildcard matching.
 
Naveen Mishra
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The same is true for Oracle and DB2 as well.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic