Given the following structure There's a way to enforce that Table1.id3 only can seted to values in Table4.id3 where Table4.id2 = Table1.id2? Initially I thought in a CHECK constraint, but subqueries are not allowed.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
It seems to me like you could just set a foreign key constraint directly to Table4.
You might have to jump through a hoop or two to prevent a cycle in the constraints.
You can add
Or you can enforce constraint by creating indexed view.