Subject RE: [firebird-support] Database not assigned
Author Alan McDonald
> Hi
>
> I have a program made in D5 Ent using InterbaseExpress Comp.
> I Connect to a FB DB (FB version 1.0.3).
> The FB runs either on Windows 98 or Windows 2000 Server.
>
> In my app. I sometimes do a update of the DB (Creating new table,
> view, stored procedure etc.).
>
> I Usually creates this in IBExpert and the take the SQL needed and
> put in a TIBScript.
> I only update the DB when there is NO USERS ATTACHED except this one
> machine.
> I Connects as SYSDBA always.
>
> Then lately I have created some new tables with the SQL from IBExpert.
> This can be as follows:
>
> CREATE TABLE POINT_AFSLUT_KVIT(
> ID INTEGER NOT NULL);
>
> Commit
>
> alter table POINT_AFSLUT_KVIT
> add constraint PK_POINT_AFSLUT_KVIT
> primary key (ID);
>
> Commit
>
> CREATE GENERATOR GEN_POINT_AFSLUT_KVIT_ID;
>
> Commit
>
> SET TERM ^ ;
>
> CREATE TRIGGER POINT_AFSLUT_KVIT_BI FOR POINT_AFSLUT_KVIT
> ACTIVE BEFORE INSERT POSITION 0
> AS
> BEGIN
> IF (NEW.ID IS NULL) THEN
> NEW.ID = GEN_ID(GEN_POINT_AFSLUT_KVIT_ID,1);
> END
>
> ^
>
> SET TERM ; ^
>
>
> Commit
>
>
>
> Then as the last thing IBExpert gives me this SQL Statement, which I
> also (try) to execute.
>
> UPDATE RDB$RELATION_FIELDS F1
> SET F1.RDB$DEFAULT_VALUE = NULL,
> F1.RDB$DEFAULT_SOURCE = NULL
> WHERE (F1.RDB$RELATION_NAME = 'POINT_AFSLUT_KVIT') AND
> (F1.RDB$FIELD_NAME = 'ID');
>
>
> But this always gives me DATABASE NOT ASSIGNED.
>
> As I recall IBExpert didn't give me this statement in earlier version
> (I have the newest version available).
>
> My questions are:
>
>
> 1.
> Why do I get this error ?
>
> 2.
> What does this last SQL Statement actually do ?
>
>
> Regards
>
> Michael

Interesting - I have another issue with this statement - it is issued when
you change a field from being not null to allow NULL and it appeas to be
issued when changing back.
In any case - this is a question for the IBExpert NG not here.
The last statement is DML SQL and it is manipulating system tables. Your
script already uses DDL to do the same thing when it issues
> alter table POINT_AFSLUT_KVIT
> add constraint PK_POINT_AFSLUT_KVIT
> primary key (ID);
the above statement.
For the moment do not let this system table script run as part of your
update, leave it out and ask IBExpert about it.
In any case.. where are you getting it from? Are you setting a log file
going ro remember the script? Then this is why you are catching it.
A better way to create the script you are after is to use the DB Comparer
tool in IBExpert - it will create a proper scrip for you to use.
Alan