Subject Re: [ib-support] Add a column to a table via stored proc
Author Martijn Tonies
Dave,


> I am using ibobjects with firebird.
> I want to add a column to table B when a new record is added to Table A.
Via
> a trigger and a stored proc.
>
> I cannot do this using SQL syntax ('alter table B add Fred smallint')
> because that is not available in stored proc.

Right - and for a reason.

>But I suppose I can alter the
> appropriate RDB$ files by stored proc.
>
> It is a very simple column of smallint with no index or other constraints
> that I want to add (or occasionally drop). I see that I can add a record
to
> RDB$RelationFields.

I haven't tried it, but I expect it not to work either.

> But are there any dire pitfalls to this ?

Yes - you can only change a table 255 times before a backup/restore
cycle is needed.

> And are there other RDB$ entries to be made at the same time.

> (In other words what, in terms of the system relations, does the sql
> statement "alter table B add Fred smallint" achieve ?)

The question shouldn't be: "can it be done?" It should be: "why do you
want to do this?"


With regards,

Martijn Tonies
InterBase Workbench - the developer tool for InterBase
http://www.upscene.com

Firebird Workbench - the developer tool for Firebird
http://www.upscene.com

Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."