In Sql Server 2005, I have a table with two whole columns, name them Id1 and Id2. I need them to be unique in the table (simple enough with a unique index that spans both columns). I also need them to be unique in the table if the values ββare transposed between two columns.
For example, SELECT * FROM MyTable returns
Id1 Id2
---------
2 4
5 8
7 2
4 2 <--- values transposed from the first row
How to create a constraint that will prevent the last row from being entered into the table, since they are transposed values ββfrom the first row?
jsr
source
share