Up Prev Next
From: emdmmx at chron dot com (Michael Matthews)
Subject: Re: single quotes in TEXT
Date: Apr 16 1998 4:38PM
David Carter wrote:
> (I sending this again as I've just changed my domain and had to take
> myself off the list and subscribe again. Apologies if this comes out
> Hope this is an easy one for my first posting:
> How do I insert a TEXT datatype containing a '?
> Read the FAQ, but didn't find a satisfactory solution (the description for
> dbsafestr seems to imply that it will convert ' to "). It's not correct to
> say `David"s book`. Besides - it looks wierd. As would `David`s Book`.
I believe it's converting ' to '' -- that is, not a double quote
("), but two single quotes. If your string in the SQL statement
is delimited with single quotes, then any single quotes within
the string need to be doubled. So you would
insert foo (bar) values ('David''s Book').
The reverse is true if you're using double quotes to delimit
your string, as in
insert foo (bar) values ("I always say, ""Don't blame me!""
when the server goes down...")
Mike Matthews email@example.com