I've got a DBA Relational Design question.  I've got two tables, one a
category table, and the other a detail table where one field is a Foreign
Key to the category table.  In my DBMS (SQL Server 2000), I am trying to set
up this relationship/constraint.  It is not allowing me to do this.  It
gives me an error, because there are category records in the category table
that have not yet been used in the detail table.  Is this correct behavior,
or am I doing something wrong?  When creating a one to many relationship
between tables, must you have matching keys for all records on both sides?

A simple example

Color Category Table
ID      Name
1       Red
2       Blue
3       Green

Product Detail Table
ID      Name    Color
1       Bike    1
2       Bike    2
3       Trike   1
4       Trike   2
5       Unicyc  1

I am unable to create a relationship in this case, because there are no
records in the Detail table that yet use the color Green.  This can't be
correct?  If it is not correct, what may I be doing to cause the error.


--------------
Ian Skinner
Web Programmer
BloodSource
Sacramento, CA
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=6
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=6

Get the mailserver that powers this list at 
http://www.coolfusion.com

                        

Reply via email to