Link to home
Start Free TrialLog in
Avatar of hconant
hconantFlag for United States of America

asked on

Setting FK in SQL server management studio

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
Avatar of nybelle
nybelle

Within Management Studio, open the keys/indexes properties on the Team table. There you can create the FK.
Avatar of hconant

ASKER

I did that, tried that.  I established the relationship but there is no FK next to the field in the database design view.
SOLUTION
Avatar of sridharkamala
sridharkamala

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hconant

ASKER

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?
Avatar of hconant

ASKER

In VWD, Database Explorer there is no Keys in the Team table ladder.  All i have are the columns.
Avatar of hconant

ASKER

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?
ASKER CERTIFIED SOLUTION
Avatar of EugeneZ
EugeneZ
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial