[thelist] SQL Server Help

rudy r937 at interlog.com
Thu Jun 6 15:00:01 CDT 2002


>  I'm no rudy that's for sure. :)

thanks, chris, that is very kind

josh, your FK error message will make sense if you think of how many unique
values each FK value can refer to

table relationships involving keys are always one-to-many

one "parent/master" row is related to multiple "child/detail" rows

the child/detail row "points to" the parent/master row

so the FK must be in the child/detail row

     Table1
     Column_1_1  Primary Key
     Column_1_2
     Column_1_3  Foreign Key  = Column_2_1

     Table2
     Column_2_1  Primary Key
     Column_2_2  Primary Key

the way i understand this, you want each record in Table2 to have multiple
related records in Table1

but you cannot declare just Column_2_1 as the target of theTable1 FK (the
database won't let you) because it's not unique

(Column_2_1 is not unique unless either it is the PK by itself, which it's
not, or it has a unique constraint defined on it, which is what your error
message is telling you)

are you sure you have the FK pointing in the right direction?

it's hard to tease much semantic meaning from your column names  ;o)


rudy





More information about the thelist mailing list