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 |
|
rajani
Constraint Violating Yak Guru
367 Posts |
Posted - 2004-05-13 : 22:30:06
|
| Hi friendsI've table Task with following fldstaskid,type,fk_idif type='I' then it referes to another table i.e Master.pkeyif type='T' then it referes to another table i.e Transact.pkeymy question is, is it possible to create a condition foreign key on task table?Thanks for ur ideasCheers |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-05-13 : 22:37:57
|
| No. You can have a logical key, meaning on that's not enforced and interpreted by your application to determine the table it's from. You need to have two foreign keys. You could also break the tasks out for Master and Transact, then have a table that joins the Master tasks to the Transact tasks.MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
rajani
Constraint Violating Yak Guru
367 Posts |
Posted - 2004-05-13 : 22:41:49
|
| Thanks for quick reply DerrickMay b i need to split fk_id field into 2 fields and one refers to Master.pkey and other referes to Transact.pkeyam i right?Cheers |
 |
|
|
|
|
|