Double quotes, backslash, replace in sql

0

a help here, I try to replace double quotes (") with (\") backslahs + double quotes, in the database to be able to take it to JSON, but I do not understand gives me this error

Msg 8152, Level 16, State 14, Line 20 String or binary data would be truncated. The statement has been terminated. (371 row(s) affected)

and does not perform the operation. This is what I have.

    ID |descripcion
  20376|APRUEBA CONVENIO DE SUBSIDIO CON "EXPLOTACIONES AGRICOLAS TRICAHUE LIMITADA" PARA LA EJECUCIÓN DEL PROYECTO DENOMINADO capitasem
  20377|APRUEBA CONVENIO DE SUBSIDIO CON "EXPLOTACIONES AGRICOLAS TRICAHUE LIMITADA" PARA LA EJECUCIÓN DEL PROYECTO DENOMINADO capitasem

I need this

     ID |descripcion
   20376|APRUEBA CONVENIO DE SUBSIDIO CON \"EXPLOTACIONES AGRICOLAS TRICAHUE LIMITADA\" PARA LA EJECUCIÓN DEL PROYECTO DENOMINADO capitasem
   20377|APRUEBA CONVENIO DE SUBSIDIO CON \"EXPLOTACIONES AGRICOLAS TRICAHUE LIMITADA\" PARA LA EJECUCIÓN DEL PROYECTO DENOMINADO capitasem

This is the code, but it gives me the previous error

UPDATE #tabletemp2
SET descripcion= REPLACE(descripcion, '"', '\"') FROM #tabletemp2
Select * from #tabletemp2

When I do it with the select it makes it perfect but to upload it to the base it gives me an error I do not understand

    
asked by Javier Marin 11.07.2018 в 22:08
source

0 answers