In table A I have 2 columns:
ID (int, PK)
MaxUsers (int)
In table B I have 2 columns:
ItemID (int)
UserID (int)
The number of records in table A with matching ItemID‘s cannot exceed the MaxUsers value.
Is it possible to write a T-SQL Table Constraint so that it’s not physically possible for this to ever happen?
Cheers!
Curt
You could write an on-insert/update trigger that does a rollback of the query when the conditions are no longer met.