Subject | Updating field length |
---|---|
Author | Paul R. Gardner |
Post date | 2006-09-18T15:49:16Z |
I have a VarChar field that I want to increase the length of (from 4 to
6). I run:
ALTER TABLE MYTABLE ALTER MYFIELD TYPE VARCHAR(6);
Now I get an error because it's used in stored procedures and triggers.
So I have two options:
1) Drop all stored procedures/triggers, alter the field, and finally add
back my stored procedures/triggers
2) Run the following:
UPDATE RDB$FIELDS SET RDB$FIELD_LENGTH = 6,
RDB$CHARACTER_LENGTH = 6,
RDB$CHARACTER_SET_ID = NULL
WHERE RDB$FIELD_NAME = (SELECT RDB$FIELD_SOURCE
FROM RDB$RELATION_FIELDS
WHERE RDB$RELATION_NAME = 'MYTABLE' AND
RDB$FIELD_NAME = 'MYFIELD')
This is something that will run in a script at users locations. Is
there a preferred method for this?
[Non-text portions of this message have been removed]
6). I run:
ALTER TABLE MYTABLE ALTER MYFIELD TYPE VARCHAR(6);
Now I get an error because it's used in stored procedures and triggers.
So I have two options:
1) Drop all stored procedures/triggers, alter the field, and finally add
back my stored procedures/triggers
2) Run the following:
UPDATE RDB$FIELDS SET RDB$FIELD_LENGTH = 6,
RDB$CHARACTER_LENGTH = 6,
RDB$CHARACTER_SET_ID = NULL
WHERE RDB$FIELD_NAME = (SELECT RDB$FIELD_SOURCE
FROM RDB$RELATION_FIELDS
WHERE RDB$RELATION_NAME = 'MYTABLE' AND
RDB$FIELD_NAME = 'MYFIELD')
This is something that will run in a script at users locations. Is
there a preferred method for this?
[Non-text portions of this message have been removed]