LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-26-2010, 11:50 PM   #1
struct
Member
 
Registered: Feb 2009
Posts: 68

Rep: Reputation: 10
sql query help


I have to search for a string with question marks and the query doesn't show any results. I'm 100% positive there are strings with ? in the front of the it but can't find any.

select * from table like '?%'

doesn't seem to work.

do I need to escape the question mark? If so, how do I escape it within the query?

Last edited by struct; 10-26-2010 at 11:51 PM.
 
Old 10-26-2010, 11:58 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Use the SQL "escape" clause:

http://www.orafaq.com/faq/how_does_o...ng_sql_queries

Code:
select * from table like '\?\%' ESCAPE '\';
 
1 members found this post helpful.
Old 10-27-2010, 12:29 AM   #3
struct
Member
 
Registered: Feb 2009
Posts: 68

Original Poster
Rep: Reputation: 10
thank you so much.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL query question Kamikazee Programming 2 10-31-2006 10:27 AM
Query SQL error gabsik Linux - Software 37 07-22-2006 02:34 AM
SQL query performance smaida Programming 6 06-08-2005 09:22 AM
SQL query help pls. vickr1z Programming 8 10-18-2004 11:25 PM
Massive SQL Query patpawlowski Programming 7 03-05-2004 04:24 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration