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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Defining Table Relationships 2

Status
Not open for further replies.

Skittle

ISP
Sep 10, 2002
1,528
US
I am looking into using SQL Server after using Access for some time. Something I'm having difficulty with is table relationships.

In Access you have a GUI screen to define table relationships ( Tools--->Relationships ).
I can't find the equivalent in SQL Server. Does it exist or is it done in a very different way?



Dazed and confused
 
To define relationships you can either write T-SQL to create foreign key constraints (see thread183-1005876 for example) or you can use Enterprise Manager GUI. Right-click table -> Design table.

--James
 
Another way to create relationships is to create diagrams (found in Enterprise Manager). Then you can drag the field from one table to another. The T-SQL method is the best method though. When you make changes to databases in Enterprise Manager, it does not use the alter table command. Rather it creates a new table, populates it with your existing data, drops the old table and renames the new one. As you can see this can be quite inefficient especially if you have a lot of data in the table. If you want to use the GUI, use it on development databases only. It is usually best to use scripts to change production databases.

Questions about posting. See faq183-874
Click here to learn Ways to help with Tsunami Relief
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top