ALTER TABLE query

  • Thread starter Thread starter Ivan Debono
  • Start date Start date
I

Ivan Debono

Hi all,

I have the following sql:

ALTER TABLE details_table ADD constraint FK_mastertable_detailstable
REFERENCES master_table (id)

Where id is the pimary key of the master table.

The problem is that it's not creating a relationship between the 2 tables.
Am I skipping something?

Thanks,
Ivan
 
Hi Ivan,

While I do not profess any expertise in DDE queries, I think you need to
give each relation a unique name and include Foreign key. Try the following:

ALTER TABLE details_table
ADD constraint RELATION1 FOREIGN KEY ([FK_mastertable_detailstable])
REFERENCES master_table ([id]);


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

Hi all,

I have the following sql:

ALTER TABLE details_table ADD constraint FK_mastertable_detailstable
REFERENCES master_table (id)

Where id is the pimary key of the master table.

The problem is that it's not creating a relationship between the 2 tables.
Am I skipping something?

Thanks,
Ivan
 
Oops....meant to say "DDL" (Data Definition Language) queries, not DDE, which
is short for Dynamic Data Exchange.
____________________________________________

:

Hi Ivan,

While I do not profess any expertise in DDE queries, I think you need to
give each relation a unique name and include Foreign key. Try the following:

ALTER TABLE details_table
ADD constraint RELATION1 FOREIGN KEY ([FK_mastertable_detailstable])
REFERENCES master_table ([id]);


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

Hi all,

I have the following sql:

ALTER TABLE details_table ADD constraint FK_mastertable_detailstable
REFERENCES master_table (id)

Where id is the pimary key of the master table.

The problem is that it's not creating a relationship between the 2 tables.
Am I skipping something?

Thanks,
Ivan
 
Tom Wickerath said:
Oops....meant to say "DDL" (Data Definition Language) queries, not DDE,
which
is short for Dynamic Data Exchange.
____________________________________________

:

Hi Ivan,

While I do not profess any expertise in DDE queries, I think you need to
give each relation a unique name and include Foreign key. Try the
following:

ALTER TABLE details_table
ADD constraint RELATION1 FOREIGN KEY ([FK_mastertable_detailstable])
REFERENCES master_table ([id]);


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

Hi all,

I have the following sql:

ALTER TABLE details_table ADD constraint FK_mastertable_detailstable
REFERENCES master_table (id)

Where id is the pimary key of the master table.

The problem is that it's not creating a relationship between the 2 tables.
Am I skipping something?

Thanks,
Ivan

Yep, that was the missing parentheses around the id :)

Ivan
 
Back
Top