我需要使用SQL Server在我的表中定义唯一索引键。多列唯一索引键
例如:
ID Contact1 Contact2 RelationType
-------------------------------------------------------------------
1 1 2 sister // 1 is the 2nd sister
2 3 4 brother // 3 is the 4th brother
3 5 1 father // 5 is the 1st father
4 2 1 sister // bad entry !!!
现在,我怎样才能禁止插入错误数据像上表中使用唯一索引键的第四ID?
为什么第四个条目不好? –
第四个ID Contact1和Contact2类似于第一个ID。 – Nildarar
好的。 contact1和contact2代表什么? –