I've created a script to export the content from a table to generate another script to insert on another database. On a specific field, I have a SQL statement saved from a application in this format:
(...other fields values...),'Select case
when @myVar in ('1','4') then '1'
when @myVar in ('18','20') then '2'
when @myVar = '5' then '5'
when @myVar = '8' then '6'
when @myVar = '21' then '7'
when @myVar = '16' then '9'
when @myVar = '7' then '10'
when @myVar in ('22','34') then '11'
when @myVar = '11' then '12'
when @myVar = '10' then '13'
when @myVar = '9' then '14'
when @myVar = '13' then '15'
when @myVar = '3' then '20'
when @myVar = '17' then '22'
else '1'
end', (...other fields values...)
You may notice that the inner apostrophe is crashing the script.
How I can insert the original string as is?
I trying use replace with many ways but I can not get it to succeed.