Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Setting FK in SQL server management studio

Posted on 2009-05-08
7
Medium Priority
?
668 Views
Last Modified: 2012-05-06
I am not an experienced programmer and am setting a small sports team DB using SQL Management Studio for our web site.  I have two tables.  One is TeamType.  It has a PK of TeamTypeID, then TeamName.  That will hold team types like baseball, soccer, basketball, etc.  Then I have a Team table.  PK is TeamID. I would like a FK of TeamTypeID.  But without coding, I don't see how to set this as a FK in the Team table.  Thanks for helpl
0
Comment
Question by:hconant
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 

Expert Comment

by:nybelle
ID: 24338212
Within Management Studio, open the keys/indexes properties on the Team table. There you can create the FK.
0
 

Author Comment

by:hconant
ID: 24338381
I did that, tried that.  I established the relationship but there is no FK next to the field in the database design view.
0
 

Assisted Solution

by:sridharkamala
sridharkamala earned 400 total points
ID: 24338412
Expand TEAM table -- > Keys and you should see the Foreign key.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:hconant
ID: 24338434
Maybe I am doing that wrong.  When I go to Team table and go to Add in the Indexes/Keys it defaults to adding IX_Team*, which is I assume an index, not a key?  If I go to Foreign Key Relationships it seems to be where I can establish the relationship.  In this case I have a FK_Team_TeamTypeID.  Foreign Key Base Table=Team.  Foreign Key Columns=TeamTypeID. Primary/Unique Key Base=TeamType. Primary/Unique Key Column=TeamTypeID.  This looks correct to me, but there is no FK next to the TeamTypeID column in Team table, like there is a key symbol next to TeamID.  Have I successfully created the relationship and don't know it?
0
 

Author Comment

by:hconant
ID: 24338458
In VWD, Database Explorer there is no Keys in the Team table ladder.  All i have are the columns.
0
 

Author Comment

by:hconant
ID: 24338476
I opened the DB with SQL Management Studio and I see the keys.  But that doesn't show in VWD.  Maybe it just that way?
0
 
LVL 43

Accepted Solution

by:
Eugene Z earned 1600 total points
ID: 24339032
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question