Reputation: 9119
I want to update a row which has some html tags inside. For instance:
src='/imagem.png'></ p></ body>
> UPDATE ISTANBUL_TABLE SET TEXT = '<
> body>< p>< img src='/imagem.png '></
> p></ body>' WHERE 1=1
You see after src='
means the query ends, but it does not end. How can i solve it without using "
(double comma)? Any solution please?
best regards bk
Upvotes: 0
Views: 449
Reputation: 147224
Use parameterised SQL:
UPDATE ISTANBUL_TABLE SET TEXT = @HTML WHERE...
Then from your calling code, you just pass in the @HTML parameter and don't need to double up the single quotes.
Upvotes: 1
Reputation: 129792
You need to escape the single-quotes, by typing them twice:
UPDATE ISTANBUL_TABLE SET TEXT = '< body>< p>< img src=''/imagem.png ''>' WHERE 1=1
Also, your WHERE
clause is nonsensical and can be dropped entirely
UPDATE ISTANBUL_TABLE SET TEXT = '<body><p><img src=''/imagem.png''>'
Upvotes: 4