D
Dan Neely
Is it possible to set a constraint on a table across two fields such
that one of the pair must have a value and the other be null?
that one of the pair must have a value and the other be null?
Dan said:Is it possible to set a constraint on a table across two fields such
that one of the pair must have a value and the other be null?
Is it possible to set a constraint on a table across two fields such
that one of the pair must have a value and the other be null?
Marshall Barton said:Dan said:Is it possible to set a constraint on a table across two fields such
that one of the pair must have a value and the other be null?
You can use the table's Validation Rule:
[f1] Is Not Null Or [f2] Is Not Null
well, such a table might be arguably improperly normalized: a field should
depend only on the primary key, not the value of another field!
Klatuu said:Marsh,
The OP is looking for one to be Null and the Other to have value. I believe
that as coded, you will get True if both have value. I suggest:
([f1] Is Not Null And [f2] Is Null) Or ([f1] Is Null And [f2] Is Not Null)
*nod* MY DB background is rather minimal I'm not entirely sure if
what I want to do is a good idea.
Essentially I have two tables with different types of objects Foo and
Bar. The contents of these wouldn't make sense to be merged. Both
Foo and Bar objects however are processed by the same group of users
and follow an almost identical workflow. Tasking for the users is
currently stored in seperate link tables for each. both store an ID
for the user, and an ID for the task, with the only difference being
that one stores a FooID and the other a BarID. What I was considering
doing was to create a single assigned work table for both Foo and Bar
objects. This would require having a FooID or a BarID (but not both)
in every row.