Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to 'UPDATE' text field
Message
 
À
09/07/2007 14:27:39
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01238687
Message ID:
01238691
Vues:
6
>Can anyone tell me how you'd use the UPDATE command in T-SQL to update a memo field that had imbedded CRLF and quotes, etc. For example, if you wanted to update a text field (memo type, unlimited) with the following info:
>
>UPDATE mytable SET mymemofield = '
>This is a note we wrote
>and it's on multiple lines
>and "fred" wrote it. '
>WHERE key = '1234'
>
>
>As you can see from the above, the note itself includes quotes (single and double) in addition to CRLF.
>
>What delimeter could we use so that the quotes don't mess things up, and will the embedded CRLF mess it up?
>
>Thanks.
>
>Bob

Just double every single quote inside the message:
UPDATE mytable SET mymemofield = '
This is a note we wrote
and it''s on multiple lines
and "fred" wrote it.  '
WHERE key = '1234'
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform