Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Escaping quote character
Message
 
 
À
06/10/2014 11:06:42
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Scripting
Versions des environnements
SQL Server:
SQL Server 2012
Application:
Web
Divers
Thread ID:
01608856
Message ID:
01608857
Vues:
35
This message has been marked as a message which has helped to the initial question of the thread.
>Usually, when I generate a script, the quote character is converted like this:
>
>
>...WHERE Client.City='Michel''s city'
>
>
>That would work.
>
>I can also do this:
>
>
>...WHERE Client.City='Michel'+CHAR(39)+'s city'
>
>
>But, in cases where I need to pass the entire command as a variable, I cannot use the double quote and SQL Server complains if I use this:
>
>
>SET @SQL='...WHERE Client.City=''Michel'+CHAR(39)+'s city'''
>
>
>It does not like CHAR(39) if inserted inside a string which is also inserted inside a string.
>
>Any idea on how to resolve this?
SET @SQL='...WHERE Client.City=''Michel''''s city'''
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform