Board index » delphi » error -object in use- when adding foreign key constraint

error -object in use- when adding foreign key constraint

When I run the below script in IBConsole against an empty database as SYSDBA
I get the error:
"Unsuccessful metadata update object SERIE_ENHED is in use ".
If I remove the foreign key constraint from the script, I get no errors.
However if I then do
"alter table serie add
  constraint fk_serie_serie_enhed
    foreign key (serie_enhed_recnum)
    references serie_enhed(serie_enhed_recnum)"
i get the same error again.
What does "object is in use" mean and how do I aviod it?

TIA
Peter Laursen

script:
create table serie_enhed(
  serie_enhed_recnum          integer              not null,
  opdateret_dato              date                 not null,
  enhed_type                  integer              not null,
  intern_kommentar            varchar(4000),
  constraint pk_serie_enhed
    primary key(serie_enhed_recnum),
  constraint ck_serie_enhed_type
    check(enhed_type in (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14)),
  constraint uk_serie_enhed
    unique(enhed_type)
);

create table serie(
  serie_recnum                integer            not null,
  opdateret_dato              date               not null,
  navn                        varchar(60)        not null,
  navn_upper                  varchar(60)        not null,
  serie_enhed_recnum          integer            not null,
  decimaler                   integer            not null,
  tidsoploes_recnum           integer            not null,
  serietype                   integer            not null,
  formel                      varchar(200),
  kommentar                   varchar(4000),
  constraint pk_serie
    primary key(serie_recnum),
  constraint fk_serie_serie_enhed
    foreign key (serie_enhed_recnum)
    references serie_enhed(serie_enhed_recnum)
);

 

Re:error -object in use- when adding foreign key constraint


Also, make sure you're the only one connected to the database.

--
Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com

Upscene Productions
http://www.upscene.com

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

Quote
"Robert Schieck" <rschi...@mers.com> wrote in message

news:VA.00000238.0ee17b11@mers.com...
Quote
> I put a commit between the create table statements and it ran fine
> against IB 6.0 open source.

> hth

> Robert Schieck (TeamB)
> MER Systems Inc.
> Inprise/Borland/InterBase Search Engine
> http://www.mers.com/searchsite.html

Re:error -object in use- when adding foreign key constraint


I put a commit between the create table statements and it ran fine
against IB 6.0 open source.

hth

Robert Schieck (TeamB)
MER Systems Inc.
Inprise/Borland/InterBase Search Engine
http://www.mers.com/searchsite.html

Other Threads