Subject Unique Constraint on 2 fields
Author Alan McDonald
I have 2 cols in a table
COL1 COL2
1 1
1 2
1 3
2 1
2 2
2 3

I'm trying to add a unique constraint for the two cols. But of course they
are not unique individually, only in combination.
This command
alter table MYTABLE
add constraint UNQ_TABLECON
unique (COL1,COL2)
results in
Invalid insert or update value(s): object columns are
constrained - no 2 table rows can have duplicate column values.
attempt to store duplicate value (visible to active transactions) in unique
index

Is there a simple way to enforce uniqueness in the combination of the
columns?
Alan