Board index » delphi » Newbie Foreign Key constraint question
srdaniel
![]() Delphi Developer |
Sat, 27 Nov 2004 04:03:54 GMT
Newbie Foreign Key constraint question
I want to create my primary index using "CREATE UNIQUE INDEX
IDX_PK_NAME..." instead of specify a constraint in my CREATE TABLE. Mainly so that my primary keys have a name rather than RDB$PRIMARY1453 or whatever. So this works CREATE TABLE "LOCATIONS" CREATE TABLE "BUILDINGS" CREATE UNIQUE INDEX "IDX_PK_LOCATIONS" ON LOCATIONS ("LOCATION_REF"); However when I try to add my foreign key constraint...like this... ALTER TABLE "BUILDINGS" ADD CONSTRAINT "FK_LOCATIONS_LOCATION_REF" I always get a message "Unsuccessful metadata update However if I use the PRIMARY KEY CONSTRAINT as follows, it will let me CREATE DOMAIN "DOM_PK_FIELD" AS INTEGER NOT NULL; CREATE TABLE "LOCATIONS" CREATE TABLE "BUILDINGS" ALTER TABLE "BUILDINGS" ADD CONSTRAINT "FK_LOCATIONS_LOCATION_REF" srdan...@hotmail.com |