Subject Re: Changing field all places
Author Michael Vilhelmsen <Michael.Vilhelmsen@M
Actually it was the content of the field I would like to change

--- In, Lele Gaifax <lele@n...> wrote:
> >>>>> Paul Vinkenoog l'ha dit:
> >> Can I do smething, to change to condition of this field, so
> >> that upon change the DB will change it in all places where it
> >> is being reference as a foreign key ?
> Paul> Yes, when you define a foreign key you can add: ON UPDATE
> Uhm, maybe I'm wrong, but I thing he meant something different. I
> understand the question as "how can I modify the kind of a field in
> table, that's a foreign key in other tables?", ie it's not related
> the *content* of the field, but rather to it's definition.
> If this is the case, I'd suggest using DOMAINs whereever you can.
> start by creating a new domain, say "VARCHAR_ID", equivalent to the
> current declaration of your primary key
> CREATE DOMAIN varchar_id AS varchar(20)
> then I'd proceed by modifying every field in each table that refers
> that PK, ie
> ALTER TABLE blabla ALTER COLUMN field TYPE varchar_id
> or something similar (I do not have manuals at hand).
> From that point, just modifying your new domain will propagate the
> effect to all affected fields!
> hth,
> ciao, lele.
> --
> nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
> real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
> email: lele@s... | -- Fortunato Depero, 1929.