Subject | Re: [firebird-support] Re: Changing VARCHAR character set and BLOB sub type |
---|---|
Author | Helen Borrie |
Post date | 2008-02-25T03:03:23Z |
At 12:05 PM 25/02/2008, you wrote:
alter myblob type blob sub_type 0
or
alter table mytable
alter myblob type blob sub_type binary
This doesn't change data, of course, since the engine neither knows nor cares what's in a blob. All you're doing here is removing the association between your blob and the blob filter that underlies the TEXT Blob, allowing some string functions to be applied to it.
alter table mytable
alter mycolumn varchar(20) type character set octets;
If you do have a COLLATE on the column currently, do it like this:
create domain dom_20_octets as varchar(20) character set octets collate octets;
commit;
alter table mytable
alter mycolumn type dom_20_octets;
Note that it's not *this* easy converting char columns, or varchar columns involving multi-byte character sets. So, although you weren't asking about that, it's the kind of question people don't willingly reply to unless they've got a lot of time on their hands....and it has come up dozens of times in the list.
./heLen
>I can't believe there isn't a way to do this...'course there is.
>--- In firebird-support@yahoogroups.com, "Lee" <waywardwretch@...> wrote:alter table mytable
>>
>> What is the best/easiest way to change...
> (B) a BLOB field's subtype from TEXT to BINARY?
alter myblob type blob sub_type 0
or
alter table mytable
alter myblob type blob sub_type binary
This doesn't change data, of course, since the engine neither knows nor cares what's in a blob. All you're doing here is removing the association between your blob and the blob filter that underlies the TEXT Blob, allowing some string functions to be applied to it.
>>You happen to have an "easy" conversion here because you're going varchar-to-varchar with single-byte characters. If you have no COLLATE attribute on the current definition, it is as easy as this (converting a varchar(20) for example):
>> (A) a VARCHAR field's character set from ISO8859_1 to OCTETS?
>>
alter table mytable
alter mycolumn varchar(20) type character set octets;
If you do have a COLLATE on the column currently, do it like this:
create domain dom_20_octets as varchar(20) character set octets collate octets;
commit;
alter table mytable
alter mycolumn type dom_20_octets;
Note that it's not *this* easy converting char columns, or varchar columns involving multi-byte character sets. So, although you weren't asking about that, it's the kind of question people don't willingly reply to unless they've got a lot of time on their hands....and it has come up dozens of times in the list.
./heLen