473,396 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

search for special character

144 100+
hi,

how to search a string in a table that contain a special character ?

for example i want to search fo a string "D'Crepes" in a field of a table.
i've tried using the following sql from vb .net

Expand|Select|Wrap|Line Numbers
  1. select name from menu where name like '%D'Crepes%'
but since ' is a special character, i got an error. is there anyway to do this, like using \ in mysql?

Thank you,
Nov 30 '08 #1
3 6200
ADezii
8,834 Expert 8TB
@thesti
Try:
Expand|Select|Wrap|Line Numbers
  1. SELECT Name From Menu Where InStr([Name],"D'Crepes") > 0;
Nov 30 '08 #2
nico5038
3,080 Expert 2GB
An alternative is to use the [ and ] around the special character like:

Expand|Select|Wrap|Line Numbers
  1. select name from menu where name like '%D[']Crepes%'
  2.  
These [ and ] can also be used to select a range for one character, e.g. a to k by using "[a-k]"

Nic;o)
Nov 30 '08 #3
ADezii
8,834 Expert 8TB
Nico makes an excellent point, just to add to what Nico has said, you can also search for characters outside of the Range by using the '!' within the defined Range. The following Query will return all Last Names that do not begin with the characters a thru k:
Expand|Select|Wrap|Line Numbers
  1. SELECT Employees.LastName
  2. FROM Employees
  3. WHERE Employees.LastName Like "[!a-j]" & "*";
Nov 30 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Ozer | last post by:
Hi friends, I wanna ask something. I use javascript menu on my user interface. And the js files contains special(turkish) character. I need to use codepage=1254 attribute in my @Page tag. If i...
2
by: weetat.yeo | last post by:
Hi all , I have a form that allow user to enter description , sometimes the description value have html special character for example %20 and etc. Inserting into the mysql database is ok , for...
1
by: sonald | last post by:
Dear All, I am working on a module that validates the provided CSV data in a text format, which must be in a predefined format. We check for the : 1. Number of fields provided in the text file,...
3
by: jeyabarani | last post by:
Hi guys, I want to check whether the user has entered any special characters in a text box. If the user enters, i want to display an alert message stating that he cant enter a special character...
7
by: tatata9999 | last post by:
Hi, SQL env: sql server 2000 Target column of insertion: varchar(15) Case, a var is made up of a character of the following characters (random selection):...
1
kaleeswaran
by: kaleeswaran | last post by:
Hi! i am handling password generation module..... i need to force the user enter the special character in their password thing.so i need to handle the special character.so...
1
by: Ragavendran | last post by:
Hi, I am using this method for search: Query =org.apache.lucene.queryParser.QueryParser.parse(String arg0) throws ParseException Hits = org.apache.lucene.search.Searcher.search(Query query,...
6
vekipeki
by: vekipeki | last post by:
I am having a problem with basic drawing of unicode characters in Windows 2000 and XP. I have written a simplest possible C# WinForms program to test it (just create a new Windows Forms C#...
1
by: dinesh1985singh | last post by:
Hello Everyone, In my database I found few special character,these special character were get stored even after using proper function for striping out these character,like mysql_real_escape...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.