Subject Re: [IBO] Re: TIB_Query Programatically Defined SQL with Strings
Author Paul Vinkenoog
Hi Helen,

> But, elsewhere, you doubled the single-quotes, as follows:
>
> UPDATE MyTable SET MyField = ''ABC Company, Inc.''
>
> That is two single quotes at each end of the string (not double
> quotes). As Paul pointed out, doubling the single quote causes
> the next single quote to be treated as a literal. But the above
> statement won't work, because you need THREE, not two single
> quotes in order to store your single-quote literals:
>
> UPDATE MyTable SET MyField = '''ABC Company, Inc.'''

I only saw Jack using doubled single quotes as part of this Delphi
statement:

SQL.Add('UPDATE MyTable SET MyField = ''ABC Company, Inc.''
WHERE ID = 1');

which is exactly right if you want the SQL staement to look like

UPDATE MyTable SET MyField = 'ABC Company, Inc.' WHERE ID = 1

which will store the string value as

ABC Company, Inc.

without quotes.

If he wants to store the string single-quoted, yes, he must use
tripled single quotes in the SQL statement, and therefore *sextupled*
single quotes in the Pascal assignment:

SQL.Add('UPDATE MyTable SET MyField = ''''''ABC Company, Inc.''''''
WHERE ID = 1');

Let's hope for him he wants to store the string unquoted :-)


Greetings,
Paul