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 |
|
solart
Posting Yak Master
148 Posts |
Posted - 2002-10-14 : 17:28:30
|
| Where do I find good material on how to handle insertions into a table which has a circular reference to another table?I thought BOL might cover this topic, but appearently I did not look in the right places.TIA |
|
|
AjarnMark
SQL Slashing Gunting Master
3246 Posts |
Posted - 2002-10-14 : 17:45:45
|
| What do you mean by it has a circular reference to another table? Is that because of triggers? If so, then lookup the topic of nested triggers. |
 |
|
|
solart
Posting Yak Master
148 Posts |
Posted - 2002-10-15 : 13:36:23
|
| What I mean by circular references:Is that Table Employees has a department column with a foreign key reference to Table Departments. Table Department has a employee Id (manager) with a foreign key reference to Table Employees.In order to insert into table Employees, the dept has to exist in table Departments.In order to insert into table Departments the employee id must exist in the table Employees.Which comes first, so to speak, the chicken or the egg?TIA |
 |
|
|
Onamuji
Aged Yak Warrior
504 Posts |
Posted - 2002-10-15 : 14:03:05
|
| obviously you need to let one or the other allow nulls ... or put in default values and then set the constraints ... i would allow the manger id of a department be null then insert the departments ... then the users then link the departments to the appropriate employee... |
 |
|
|
|
|
|