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
VulpesPosted Jan 5, 2012, 1:00 PM
Select * FROM table where CAST(String AS varchar) = ''':;''xx'
Sam HobbsPosted Jan 6, 2012, 4:27 AM
yokzuPosted Jan 5, 2012, 1:04 PM
It solved my problem Vulpes:)
Chintan RathodPosted Jan 5, 2012, 12:49 PM
yokzuPosted Jan 5, 2012, 12:42 PM
yokzuPosted Jan 5, 2012, 12:37 PM
Select * FROM table where String=''''':;''xx'''
The string which I wanna search is ; '':;'xx'
Chintan RathodPosted Jan 5, 2012, 12:32 PM
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'"