Shilpa
1 Mar 2022
General
I am using sqlite3 and created tables for the hybrid mobile applications. While executing insert query, it shows below error.
SQL error near line 16: near "s": syntax error
the line is,
INSERT INTO table_name (id, fullname) VALUES (98765, 'Robert O\'neils');
The issue is about escape character for a single quote.
I also tried double escaping the single quote (using \\\' instead of \' ), but that ain't work either.
What did I miss?
#sqlite #database
Rakshit
2 Mar 2022
Best Answer
Mysql syntax: Working sqlfiddle, Replace single quote with single backward slash ("\") as given below.
INSERT INTO mytable values('98765','Robert O\'neils');
Sqlite syntax: Working sqlfiddle, Replace a single quote with another single quote.
INSERT INTO table_name (id, fullname) VALUES (98765, 'Robert O''neils');
© 2024 Copyrights reserved for web-brackets.com