Subject Re: How to change collattion of a field without droping and recreating it?
Author guylainplante
Hi,

thank you for your answers.

Since I have a very big database with several tables and fields, after some research, I decided to directly update the field RDB$COLLATION_ID from the table RDB$RELATION_FIELDS and it seams to work fine.

So, since I'm not a Firebird specialit, can somebody tell me if I'm running into problems or what I did is correct?

Here is the SQL command I used to change the collate order of all my varchar fields:

update RDB$RELATION_FIELDS
set RDB$RELATION_FIELDS.RDB$COLLATION_ID = ( select RDB$COLLATION_ID from RDB$COLLATIONS where UPPER(RDB$COLLATION_NAME) = 'UNICODE_CI_AI' )
where RDB$RELATION_FIELDS.RDB$FIELD_NAME in ( select RDB$RELATION_FIELDS.RDB$FIELD_NAME
from RDB$RELATION_FIELDS, RDB$FIELDS
where RDB$RELATION_FIELDS.RDB$FIELD_SOURCE = RDB$FIELDS.RDB$FIELD_NAME
and RDB$RELATION_FIELDS.RDB$RELATION_NAME in ('TABLE1','TABLE2') /* My table list */
and RDB$FIELDS.RDB$FIELD_TYPE = 37 /* Varchar */
);