By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,560 Members | 1,070 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,560 IT Pros & Developers. It's quick & easy.

ms-access db script creation

P: n/a
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

2- I can not see in DESIGN mode (graphical view) neither PK nor FK
(relations panel)
Is there any utility to be run so db is updated or what else ?

Any idea ?

Thanks in advance

Alfredo
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"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.

Nov 12 '05 #2

P: n/a
Thank you very much John
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.