Page 1 of 1
Looking for a script to clean my data of ' for SQL
Posted: Sun Feb 19, 2012 7:54 am
by FireWorx
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
Re: Looking for a script to clean my data of ' for SQL
Posted: Sun Feb 19, 2012 11:21 am
by bangkok
to remove them.
Or you can use :
(the \' will keep the ' in your MySQL data)
Re: Looking for a script to clean my data of ' for SQL
Posted: Mon Feb 20, 2012 8:04 pm
by FireWorx
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');