问题
I have a long list of insert query which has a slight error.
INSERT INTO `delivery_zip` (..)
VALUES ("AB'C / DEF", ..), ("AB'C / DEF", ..), ("AB'C / DEF", ..), ...
How do I remove the single quote after AB' from the values.
回答1:
If the single quote in question is the only single quote present in the column col1
, and you have already inserted the data, then you should be safe using UPDATE
with REPLACE
to remove it:
UPDATE delivery_zip
SET col1 = REPLACE(col1, ''', '')
But if you haven't done the insertion yet, you could do a find and replace in your script first, possibly using a regex if needed.
来源:https://stackoverflow.com/questions/39052120/how-to-remove-a-single-quote-from-a-value-while-inserting-in-sql-database