Board index » delphi » Define foreign key failure, Interbase v 6

Define foreign key failure, Interbase v 6

I want to define a simple foreign key and i get the following error:

Unsuccessful metadata update
object TYPE_COMPONENT is in use
Statement: Create Table UNIT_CONFIG_FILE
(
 UCF_UNIT_TYPE  INTEGER NOT NULL,
 UCF_PARAM_TYPE  VARCHAR(20) NOT NULL,
 UCF_VALUE_TYPE  SMALLINT,
 UCF_DEFAULT_VALUE VARCHAR(255),
 UCF_MULTI_USED  SMALLINT,
 UCF_PARAM_NAME VARCHAR(255),
 primary key (UCF_UNIT_TYPE,UCF_PARAM_TYPE),
 foreign key (UCF_UNIT_TYPE) references TYPE_COMPONENT (UTYPE)
)

The referenced table is:

create table TYPE_COMPONENT
(
    UTYPE              INTEGER               not null,
    TYPE_NAME          CHAR(10)                      ,
    TYPE_PURPOSE       SMALLINT                      ,
    TYPE_DESCR         CHAR(150)                     ,
    primary key (UTYPE)
);

 

Re:Define foreign key failure, Interbase v 6


Mordi,

in order to create foreign keys you need exclusive access to the
database. If you have other applications connected at the same time,
please disconnect and give it a try with an exclusive connection.

Best wishes,
Sriram

Quote
Mordi wrote:
> I want to define a simple foreign key and i get the following error:

> Unsuccessful metadata update
> object TYPE_COMPONENT is in use
> Statement: Create Table UNIT_CONFIG_FILE
> (
>  UCF_UNIT_TYPE  INTEGER NOT NULL,
>  UCF_PARAM_TYPE  VARCHAR(20) NOT NULL,
>  UCF_VALUE_TYPE  SMALLINT,
>  UCF_DEFAULT_VALUE VARCHAR(255),
>  UCF_MULTI_USED  SMALLINT,
>  UCF_PARAM_NAME VARCHAR(255),
>  primary key (UCF_UNIT_TYPE,UCF_PARAM_TYPE),
>  foreign key (UCF_UNIT_TYPE) references TYPE_COMPONENT (UTYPE)
> )

> The referenced table is:

> create table TYPE_COMPONENT
> (
>     UTYPE              INTEGER               not null,
>     TYPE_NAME          CHAR(10)                      ,
>     TYPE_PURPOSE       SMALLINT                      ,
>     TYPE_DESCR         CHAR(150)                     ,
>     primary key (UTYPE)
> );

--
Sriram Balasubramanian               EMail: bsri...@borland.com
InterBase R&D, Borland
http://www.borland.com
-----------------------------------------------------------------------
This e-mail, and any attachments thereto, is intended only for use by
the addressee(s) named herein and may contain legally privileged and/or
confidential information.  If you are not the intended recipient of
this e-mail, you are hereby notified that any dissemination,
distribution or copying of this e-mail, and any attachments thereto, is
strictly prohibited.  If you have received this e-mail in error, please
immediately and permanently delete the original and any copy of any
e-mail and any printout thereof.

  bsriram.vcf
< 1K Download

Other Threads