Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Table of choices for dropdown list

Author  Topic 

DaveBF
Yak Posting Veteran

89 Posts

Posted - 2011-02-28 : 11:40:11
I've only been using SQL a short time. I am building asp .net user interfaces and I have a question on use of foreign keys.
If I have a table of people with a column for eye color I would implement it with an eyecolor table and a foreign key in People. But it seems a little awkward to have to do a Join in order to Select and display a person's eye color.
Is there a better way to do this? That is, does SQL have a way to constrain a column to contain only one of the fixed set of 4 strings, rather than a foreign key to a table containing 4 entries? Or is the foreign key to a table containing 4 entries the best way to do this?
Thanks.

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-02-28 : 12:10:06
quote:
Or is the foreign key to a table containing 4 entries the best way to do this?

Yes


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -