Subject | Re: OT: SQL Question |
---|---|
Author | dianeb77@hotmail.com |
Post date | 2001-05-22T20:18:07Z |
--- In ib-support@y..., "Rob Schuff" <rob@b...> wrote:
each single quote that you want retained as part of the string value.
For example, [in honour of St. Patrick's Day?]
update countries
set capital = 'O''ttawa'
where country = 'Canada'
select capital ...
O'ttawa
For reference, see SQL92 section 5.3 <literal>, especially Syntax Rule
9:
"<quote symbol> ::= <quote><quote>
<blah blah blah ...>
Each <quote symbol> contained in <character string literal> represents
a single <quote> in both the value and the length of the <character
string literal>. The two <quote>s contained in a <quote symbol> shall
not be separated by any <separator>."
Cheers,
db
> Folks,have an
>
> the following e-mail came in to me from a colleague. Does anyone
> answer for this?string
>
> The SQL standard specifies that single quotes are to be used around
> literals (<fieldname>='<value>') in SQL statements. <...>INSERT) of
>
> Does anyone know of a way to handle saving (with SQL UPDATE or
> strings that contain internal apostrophes (single quotes),preserving the
> single quotes within the string?The SQL standard says you should use two consecutive single quotes for
each single quote that you want retained as part of the string value.
For example, [in honour of St. Patrick's Day?]
update countries
set capital = 'O''ttawa'
where country = 'Canada'
select capital ...
O'ttawa
For reference, see SQL92 section 5.3 <literal>, especially Syntax Rule
9:
"<quote symbol> ::= <quote><quote>
<blah blah blah ...>
Each <quote symbol> contained in <character string literal> represents
a single <quote> in both the value and the length of the <character
string literal>. The two <quote>s contained in a <quote symbol> shall
not be separated by any <separator>."
Cheers,
db