Need to insert a parameter into a string using the dynamic data function from the pipeline parameters. Have tried backslash, double backslash, double single quote,@, @@, and other such nonsense. Just need a simple way to escape a single quote in a string.
Single quotes need to be escaped by backslash in single-quoted strings, and double quotes in double-quoted strings.
Essentially, just use + with escaped single quotes.
The simplest method to escape single quotes in SQL is to use two single quotes. For example, if you wanted to show the value O'Reilly, you would use two quotes in the middle instead of one. The single quote is the escape character in Oracle, SQL Server, MySQL, and PostgreSQL.
A single quote is not used where there is already a quoted string. So you can overcome this issue by using a backslash following the single quote. Here the backslash and a quote are used in the “don't” word. The whole string is accompanied by the '$' sign at the start of the declaration of the variable.
I actually found out. It's 2 single quotes apparently. I forgot to do it in both places, I had a single \ in the second place!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With