Subject Re: [firebird-support] Altering tables
Author Almond
A lazy way which I use often. Try at your own risk.

create domain NAME_LONG as varchar(80);
update RDB$RELATION_FIELDS
set RDB$FIELD_SOURCE = 'NAME_LONG'
where RDB$RELATION_NAME = 'STOCK'
and RDB$FIELD_NAME = 'STOCK_NAME';

At 09:59 04/02/06 +0200, you wrote:
>Good morning,
>
>Does anyone know of a more efficient way to perform the following
>alteration...
>
>I have a table which is already full of data, and I want to change the
>datatype
>of one of its columns (this column that needs changing might be the primary
>key).
>I have tried using ALTER TABLE commands but they don't seem to allow one
>to make a change like this, so I resorted to a very tedious and slow
>approach of
>making a temporary table (same structure as the one in question, but with
>the datatype
>change), inserting all records into it, clearing out and dropping the
>original table, creating
>a new table (with the correct name, types etc), transferring the data back
>into this one, and
>finally dropping the temporary table.
>
>Two problems with this approach are that it can be VERY slow on large
>datasets (half a
>million records) and it also seems to crash sometimes - for example, when I
>want to drop
>one of the tables, it says that the table doesn't exist. A restart of
>IBOConsole allows it
>to continue.
>
>Thanks
>Sandy
>
>
>
>
>
>
>Yahoo! Groups Links
>
>
>
>