Reputation: 1379
Pretty sure, what I am asking would be basic but I am having a difficulty in handling a series of characters in a string if those have a ' (apostrophe) in it. Couple of examples:
INSERT INTO SFAAP.WS_DIRBNK_DPST.PV_FRAUD_METRICS_03 VALUES ('MAYO FOUNDATION','AiO G17Onsi ra0g 7aDJ jWn9u2JvYR');
INSERT INTO SFAAP.WS_DIRBNK_DPST.PV_FRAUD_METRICS_03 VALUES ('KOHL'S', INC.,'gWE Q2bJhMn VXfB 2uNt'e, em3.');
Issue is, I am able to treat the 2 strings as separate and able to insert in the respective targeted columns. But when the input string itself have a apostrophe ', the snowflake interprets the end of string there and then everything breaks down.
I tried using @ in the front, triple ', even tried double-apostrophe " but none was successful. Any comments/help much appreciated.
Thank you in advance.
Upvotes: 7
Views: 25939
Reputation: 11086
Double the single quote or use a backslash to escape it. Either of these will work:
INSERT INTO SFAAP.WS_DIRBNK_DPST.PV_FRAUD_METRICS_03 VALUES ('KOHL''S'', INC.','gWE Q2bJhMn VXfB 2uNt''e, em3.');
INSERT INTO SFAAP.WS_DIRBNK_DPST.PV_FRAUD_METRICS_03 VALUES ('KOHL\'S\', INC.','gWE Q2bJhMn VXfB 2uNt\'e, em3.');
Upvotes: 7