Solved

Setting FK in SQL server management studio

Posted on 2009-05-08
7
663 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 100 total points
ID: 24338412
Expand TEAM table -- > Keys and you should see the Foreign key.
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 

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 400 total points
ID: 24339032
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Viewers will learn how the fundamental information of how to create a table.
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.

752 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