'How can I use the ' - symbol in concat function in SQL

I have values in the SQL statement as follows, for example

'$.Company_ID'

Important are the symbol: **'**. I also need to have this as string.

So I try to get it like this:

SELECT
    CONCAT('**'$.**',+ AttsData.[key], '**'**') AS XYZ
FROM
    Testtable

So as result I want to get a column which has values like

**'$.Company_ID'**

But it is not possible to concat the symbol **'** like '**'**'.

Do you have an idea how I can solve this problem.

Thank you in Advance.

sql


Solution 1:[1]

I think you just need to escape the quotes (which you commonly do by doubling up) - also not sure why you have + as part of your concat, try:

 CONCAT('**''$.**', AttsData.[key], '**''**')

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Stu