Subject | Re: DDL updates |
---|---|
Author | yeohray |
Post date | 2003-04-23T01:07:57Z |
Thx for the response.
You're right, I meant ALTER mytable ...
I guess I would need to write a simple database updater program to do
the checks then. Thanks.
Regards
Ray Mond
You're right, I meant ALTER mytable ...
I guess I would need to write a simple database updater program to do
the checks then. Thanks.
Regards
Ray Mond
--- In ib-support@yahoogroups.com, Milan Babuskov <albis@e...> wrote:
> yeohray wrote:
> > In SQL Server, I could update a table's definition by first
making
> AFAIK, PSQL is sql used in stored procedures and triggers. So you
have a
> problem here. You cannot use IF (...) in regular DSQL, only inside
> triggers and stored procedures, and you cannot execute DDL
statements in
> PSQL, so you really can't do this kind of stuff with Firebird.
>
> You can do it programatically: first select to see if there is a
column
> with:
>
> select 1 from RDB$RELATION_FIELDS where RDB$FIELD_NAME
= 'newcolumn' and
> RDB$RELATION_NAME = 'mytable';
>
> and then (if needed) run query to create it:
> ALTER mytable ADD newcolumn INTEGER;
>
> If I'm wrong, then someone please correct me, since this is one of
> "nice" features in MSSQL that don't exist in FB. If Firebird is to
allow
> this, then it would be possible to write .sql batches that update
> database structure if necessary.
>
> --
> Milan Babuskov
> http://fbexport.sourceforge.net