I know that I can set the FK restriction to make sure Table1.ColA exists in Table2.Key, however what if I want to do the opposite?
I want Table1.ColA does not exist in Table2.Key .. Can I do this with any CHECK constraint, trigger, user function, etc.? Thank!
EDIT:
Let's say I have a table called "Names":
1 Michael
2 David
3 William
Now I have a table called "Aliases":
Mike -> 1
Mikey -> 1
Dave -> 2
Bill -> 3
Will -> 3
I want to make sure that no one adds the string “Michael” to “Aliases”, as it already exists in “Names”.
source
share