If I have a string that looks like this:
This is a string
with single quotes ' all over
the ' place as well as
return characters
How would I convert this to a string that can be used in an INSERT statement?
INSERT INTO MyTable VALUES ('<the above string>');
The string above has the problems that it has return characters as well as single quotes which would mess up the validity of the INSERT statement above.
Edit: Sorry I probably should have been more clear. I'm generating a SQL Script with INSERT statements, not executing SQL within a Java app.