in my query:
SELECT * FROM ecoprosys.dataset where name="1'-Hydroxyestragole";
My query does not work, because it confuses with the my string that already have a commas in it.
in my query:
SELECT * FROM ecoprosys.dataset where name="1'-Hydroxyestragole";
My query does not work, because it confuses with the my string that already have a commas in it.
You need to escape the single quote
present in your string literal
. Try the query below:
SELECT * FROM ecoprosys.dataset where name='1''-Hydroxyestragole';
Maybe you miss using the backslash '\' to do the escape character thing.
sql_cmd='SELECT * FROM ecoprosys.dataset where name=\'1\'-Hydroxyestragole\'';
You can try the following methods:
SELECT * FROM ecoprosys.dataset where name='1''-Hydroxyestragole';
SELECT * FROM ecoprosys.dataset where name='1'+char(39)+'-Hydroxyestragole';
Single quotes are escaped by doubling them up
SELECT * FROM ecoprosys.dataset where name='1''-Hydroxyestragole';
Also
In SQL, values should be enclosed within single quote
Example: where name='john' and not name ="john"