dom_donald
Registered User.
- Local time
- Today, 19:36
- Joined
- Apr 30, 2004
- Messages
- 22
OK, I don't know if i'm being completely stupid here, but here goes anyway
:
I have a table containing a list of 'Tasks'. For each Tasks, you can specify between 1 and 4 'staff members' who are working on it. Therefore I have 4 fields in the Tasks Table, Staff_1, Staff_2, Staff_3 and Staff 4. Each of those fields holds an index into the 'Staff Table'.
In the Database Relationships, I want to maintain referential integrity such that you can not delete a member of staff from the 'Staff Table' if they are being used on a Task (in any of the four slots). I therefore specified a relationship, one-to-many, between each of these four staff slots and the Staff Table index field.
Trouble is, it's a One To Many relationship and not a Zero To Many. This means I can now no longer add a Task to the Task Table unless I specify a 'Staff member' for EVERY slot (Staff_1, Staff_2, Staff_3 and Staff 4).
PROBLEM: I would like to have BETWEEN 1 and 4 staff members i.e. I would like to be able to specify one staff member for a Task and leave the others blank - but "" is not a valid Staff Member in the Staff Table so the referential integrity is violated.
How do I get round this, without having a Staff Member called ""?
I have a table containing a list of 'Tasks'. For each Tasks, you can specify between 1 and 4 'staff members' who are working on it. Therefore I have 4 fields in the Tasks Table, Staff_1, Staff_2, Staff_3 and Staff 4. Each of those fields holds an index into the 'Staff Table'.
In the Database Relationships, I want to maintain referential integrity such that you can not delete a member of staff from the 'Staff Table' if they are being used on a Task (in any of the four slots). I therefore specified a relationship, one-to-many, between each of these four staff slots and the Staff Table index field.
Trouble is, it's a One To Many relationship and not a Zero To Many. This means I can now no longer add a Task to the Task Table unless I specify a 'Staff member' for EVERY slot (Staff_1, Staff_2, Staff_3 and Staff 4).
PROBLEM: I would like to have BETWEEN 1 and 4 staff members i.e. I would like to be able to specify one staff member for a Task and leave the others blank - but "" is not a valid Staff Member in the Staff Table so the referential integrity is violated.
How do I get round this, without having a Staff Member called ""?