我需要使用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代表什麼? –