Subject Re: [firebird-support] How to write Apostrophe (') to metadata
Author Helen Borrie
At 11:05 AM 27/11/2004 +0530, you wrote:

>Hi all
>
>I am trying to update the description of fields and tables quite
>successfully. Thanks to Dorin and all other who have helped me with it.
>
>Now I am trying to write a description with and apostrophe (') in the text
>and this doesn't work. For eg.
>
>UPDATE RDB$RELATION_FIELDS SET RDB$DESCRIPTION = 'Bhavbhuti's notebook'
>WHERE RDB$RELATION_NAME = 'ACCOUNTS' AND RDB$FIELD_NAME = 'REMARKS';
>
>I have tried to replace 'Bhavbhuti's notebook' with "Bhavbhuti's notebook"
>and [Bhavbhuti's notebook] just in case I am allowed to use the ', but no
>luck.
>
>I have also tried 'Bhavbhuti\'s notebook', 'Bhavbhuti\\'s notebook',
>'Bhavbhuti/'s notebook' and 'Bhavbhuti//'s notebook' but still no luck.
>
>Just for record I am doing this from VFP via ODBC from a Table Builder I
>have created. It allows creation of FB and VFP tables using the same VFP
>interface. It is almost done, so just in case anybody wants to have a try
>just let me know I can send a copy.

The SQL escape character for an apostrophe is another apostrophe:
UPDATE RDB$RELATION_FIELDS
SET RDB$DESCRIPTION = 'Bhavbhuti''s notebook'
WHERE RDB$RELATION_NAME = 'ACCOUNTS' AND RDB$FIELD_NAME = 'REMARKS';

Note it is two apostrophes, not a double-quote character; and it is not
confined just to metadata: it applies to all character data.

./heLen