Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HOW DO I DEFINE A RELATIONSHIP IN SQL 7

Status
Not open for further replies.

markcm

Programmer
Aug 2, 2001
10
US
Hi,

I've created many relationships in Access, but how do define/create a relationship in SQL 7??

Thanks in advance,
Mark.
 
In 2000 you can go to design view for the table, then click the relationships button. Add the new relationship in the dialog box that comes up.

I think that you can also do this by creating a diagram and using the same kind of drag and drop method used in Access where you drag a primary key over to a foreign key in another table. (Just checked and it will create the relationships from the diagram)


HTH Crystal
crystalized_s@yahoo.com

--------------------------------------------------

Experience is one thing you can't get for nothing.

-Oscar Wilde

 
you create the foreign key contraint when creating your table or as the other poster mentioned, you will use the diagram utility (which is to limited if you want to create certain types of contraints.) there is also a major drawback to using the diagram utility. if you create your tables here and your constaints (foreign keys or relationships) and existing data violates the constraint, attempting to close the diagram utility will produce errors and not allow you to save the relationships that had integrity issues.

the diagram utility is no substitute for a real ER modeller.

syntax from books online to create a multi column foreign key:

CONSTRAINT FK_sales_backorder FOREIGN KEY (stor_id, ord_num, title_id)
REFERENCES sales (stor_id, ord_num, title_id)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top