Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Foreign Keys

Status
Not open for further replies.

cfk

Programmer
Jan 16, 2002
60
GB
I have two Tables

Table A{
ColA1 - Key
ColA2 - Key
}

AND

Table B{
ColB1 - Key
ColB2 - Key
ColB3 - Key
}

The two fields in TableA correspond to ColB1 and ColB2
in TableB. The problem is ColB3 which is a DateTime field.
TableB is a log table for process' TableA has performed.
SQLServer will not let me add the FK constraint unless
all fields are mapped. i.e.
1 ColB3 does not form part of
TableBs Key or
2 I have a fields ColA3 in TableA to map

1 I need ColB3 to be part of the key because I will
be adding ColB1 and ColB2 into TableB more than once.

2 I don't what to have a new row in TableA for
each row in TableB. This would defeat the point of TableB
and would mean repeating additional data in TableA.

Any solutions
to ColB3 in TableB.
 
5 Seconds after writing this I solved the problem. Sorry.

I dragged the fields from TableB into table TableA
rather than the other way round, which I was doing before.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top