wood burning stoves 2.0*
The moose likes JDBC and the fly likes Taking entries from database containing % Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Taking entries from database containing %" Watch "Taking entries from database containing %" New topic
Author

Taking entries from database containing %

Raj Kumar Bindal
Ranch Hand

Joined: Apr 15, 2006
Posts: 418
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
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3703
    
    5

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.


My Blog: Down Home Country Coding with Scott Selikoff
Naveen Mishra
Ranch Hand

Joined: Nov 20, 2005
Posts: 75
The same is true for Oracle and DB2 as well.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Taking entries from database containing %
 
Similar Threads
JSP and JDBC errors
Taking entries from database containing %
Need technical guidance to solve my issue
Dynamic table using struts
How to use SQL database for J2EE web logins