Subject | Re: [firebird-support] Re: How to change collattion of a field without droping and recreating it? |
---|---|
Author | Alexandre Benson Smith |
Post date | 2010-08-19T19:28:20Z |
Em 19/8/2010 15:07, guylainplante escreveu:
directly with system tables.
When I need to do the same I extracted the metadata from the original
database, changed the domains to use a collation, recreate a new
database and pump over the data from the old one.
This is not an easy way, but it is a safe way to do it... i always
prefer a safe way than a easy way.
I think in your case you need at least to deactivate the indices and
reactivate again, so it could be reconstructed. This is a problema form
PK's and FK's..
see you !
> Hi,I dont think this is the best way to do it... I always avoid to mess up
>
> 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 */
> );
directly with system tables.
When I need to do the same I extracted the metadata from the original
database, changed the domains to use a collation, recreate a new
database and pump over the data from the old one.
This is not an easy way, but it is a safe way to do it... i always
prefer a safe way than a easy way.
I think in your case you need at least to deactivate the indices and
reactivate again, so it could be reconstructed. This is a problema form
PK's and FK's..
see you !