1 2 3 4 |
EXECUTE BLOCK AS BEGIN execute statement 'ALTER TABLE "table_name" ALTER "field_name" TO field_name'; execute statement 'ALTER TABLE "table_name" ALTER field_name TYPE varchar(char_length)'; END; |
or by comparison, resizing only when it is smaller than new:
1 2 3 4 5 6 7 8 |
update RDB$FIELDS set RDB$FIELD_LENGTH = 30,RDB$CHARACTER_LENGTH = char_length where RDB$FIELD_NAME =(select RDB$RELATION_FIELDS.RDB$FIELD_SOURCE from RDB$RELATION_FIELDS where (RDB$FIELD_NAME = 'field_name') and (RDB$RELATION_NAME = 'table_name') and RDB$CHARACTER_LENGTH < char_length); |
Where table_name the name of the table and field_name the name of the field.
The number of characters we put it in char_length.