Solved

Setting FK in SQL server management studio

Posted on 2009-05-08
7
655 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
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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

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 42

Accepted Solution

by:
EugeneZ earned 400 total points
ID: 24339032
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

Suggested Solutions

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

759 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now