Subject Re: [firebird-support] changing default collation order
Author Helen Borrie
At 08:43 AM 7/12/2003 +0100, you wrote:
>Helen Borrie wrote:
> > At 07:08 AM 7/12/2003 +0100, you wrote:
> >
> >>dear list
> >>
> >>a database contains exclusively german text. As far as I understand the
> >>concept, setting the database's character set to ISO8859_1 will allow to
> >>use the collation clause COLLATE DE_DE to force correct sorting. Adding
> >>this clause to every ORDER BY statement looks quite awkward to me.
> >>
> >>Is there a way to set DE_DE as default collation clause in the database?
> >
> >
> > At column level, when you define the column, you can specify a COLLATION
> > clause. Then, that column will always be sorted in that order unless you
> > specify a different one.
> >
> > /heLen
> >
>Thanks Helen
>
>Additional question
>
>to alter the collation order of a column, I have to create a temporary
>column with the desired collation order, then copy the data, right? Or
>is it possible to use ALTER TABLE?

No, COLLATION is not one of the things you can change regarding a column.

But you can do this (after dropping indexes and other dependencies):

ALTER TABLE ATABLE
ALTER ThisColumnName TO AnotherName;
commit;

alter table atable
add ThisColumnName varchar(50) character set ISO8859_1 COLLATION DE_DE;
commit;

update atable
set ThisColumnName = AnotherName WHERE AnotherName is not null;
commit;

alter table atable
drop Anothername;
commit;

Don't forget that a non-binary collation will reduce your index size
limit. For DE_DE I think it is somewhere around 80 bytes, maybe slightly
better than that.

/heLen