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.
Author |
Topic |
merrittr
Starting Member
10 Posts |
Posted - 2014-09-09 : 18:38:38
|
I have a database with a section with a hierarchy like this:[url]http://www.merrittnet.org/pics/original.JPG[/url]here everything is linked off the tblTumorSupplemental tablewhat i am being asked to now leads me to this [url]http://www.merrittnet.org/pics/after.JPG[/url]where I add a FK in the tblTumorSupplComps and tblTumorSupplMetsto link to the PK of tblTumorSupplSourceDocuments by addingALTER TABLE tblTumorSupplMetsADD TumorSupplSourceDocumentsId int NULL GOALTER TABLE tblTumorSupplCompsADD TumorSupplSourceDocumentsId int NULL GOALTER TABLE tblTumorSupplMetsADD CONSTRAINT FK_tblTumorSupplSourceDocuments_tblTumorSupplMets FOREIGN KEY (TumorSupplSourceDocumentsId) REFERENCES tblTumorSupplSourceDocuments(TumorSupplSourceDocumentsId); GOALTER TABLE tblTumorSupplCompsADD CONSTRAINT FK_tblTumorSupplSourceDocuments_tblTumorSupplComps FOREIGN KEY (TumorSupplSourceDocumentsId) REFERENCES tblTumorSupplSourceDocuments(TumorSupplSourceDocumentsId); GOis this valid or am I causing myself grief...is it valid to have null FK in the tables like I will have for previous records in tblTumorSupplComps and tblTumorSupplMets |
|
|
|
|