Hi,
I looked over the offset and char commands and searched the forum but no luck. Can anyone chime in on how to clean data of the apostrophe ' symbol so that it doesn't mess up my SQL INSERT command string?
Thanks
Dave
Looking for a script to clean my data of ' for SQL
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Looking for a script to clean my data of ' for SQL
Code: Select all
replace "'" with "" in myText
Or you can use :
Code: Select all
replace "'" with "\'" in myText
Re: Looking for a script to clean my data of ' for SQL
Found this on the SQLite site and combined it with your replace script. Replace with two single quotes in a row does the trick.
Thanks!
FROM THE SQLite documentation below.
(14) How do I use a string literal that contains an embedded single-quote (') character?
The SQL standard specifies that single-quotes in strings are escaped by putting two single quotes in a row. SQL works like the Pascal programming language in the regard. SQLite follows this standard. Example:
INSERT INTO xyz VALUES('5 O''clock');
Thanks!
FROM THE SQLite documentation below.
(14) How do I use a string literal that contains an embedded single-quote (') character?
The SQL standard specifies that single-quotes in strings are escaped by putting two single quotes in a row. SQL works like the Pascal programming language in the regard. SQLite follows this standard. Example:
INSERT INTO xyz VALUES('5 O''clock');