Hi,
I want to search a string(with special characters) in DB but it has quotation character. I tryed lot of things but it didnt work.
String is; '':;'xx'
How may search this string with a select command?
Select * FROM table where String=''
Regards.
Loading

VulpesRank #55 · 29.2K reputationPosted Jan 5, 2012, 8:00 AM EST
Select * FROM table where CAST(String AS varchar) = ''':;''xx'
Chintan RathodRank #516 · 4.8K reputationPosted Jan 5, 2012, 7:32 AM EST
SELECT * FROM TableName WHERE FieldName = 'QueryString's Value'
This is broken as the value closing delimiter appears twice; that is, there are an odd number of single quotemarks.
Solution
For most DBMS, doubling the single-quote character is the default means of escaping a single-quote.
"SELECT * FROM TableName WHERE FieldName = '" +
replace(Request.QueryString("ProNumber"), "'", "''") + "'"
This fix will produce the following statement:
"SELECT * FROM TableName WHERE
FieldName = 'QueryString''s Value'"
yokzuRank #5,421 · 300 reputationPosted Jan 5, 2012, 7:37 AM EST
Select * FROM table where String=''''':;''xx'''
The string which I wanna search is ; '':;'xx'
yokzuRank #5,421 · 300 reputationPosted Jan 5, 2012, 7:42 AM EST
Chintan RathodRank #516 · 4.8K reputationPosted Jan 5, 2012, 7:49 AM EST
yokzuRank #5,421 · 300 reputationPosted Jan 5, 2012, 8:04 AM EST
It solved my problem Vulpes:)
Sam HobbsRank #107 · 20.5K reputationPosted Jan 5, 2012, 11:27 PM EST