"Alfredo" <ag*****@teleline.es> wrote in message
news:f7**************************@posting.google.c om...
Hello, I have created the following table and her relations
CREATE TABLE bannerdetail (objectname VARCHAR(30), elementname
VARCHAR(30), sequence SMALLINT) ;
CREATE UNIQUE INDEX primarykey ON bannerdetail (objectname,
elementname, sequence) ;
CREATE INDEX bannerheaderbannerdetail ON bannerdetail (objectname) ;
CREATE INDEX elementsstorebannerdetail ON bannerdetail (elementname) ;
but
1- Foreing Keys does not work
Firstly I would advise you to explcitly declare the nullability of columns,
otherwise you may have columns in your PK that allow nulls.
create table bannerdetail
(
objectname varchar(30) not null,
elementname varchar(30) not null,
sequence smallint not null
)
Next, primary and foreign keys are declared with the constraint clause. You
may declare them in the create table statement or afterwards using alter
table. To add a primary key constraint you can do this:
alter table bannerdetail
add constraint PK_bannerdetail
primary key
(
objectname,
elementname,
sequence
)
To declare the foreign key constraints you will need to reference the
foreign table, e.g.
alter table bannerdetail
add constraint FK_bannerdetail_objectname
references objects(objectname)
Look up CONSTRAINT clause in Access Help under Jet SQL.