[DB-SIG] Portable method of determining which column
wasn't unique?
Bob Gailer
ramrom@earthling.net
Thu, 10 Oct 2002 13:48:24 -0600
--=======656C2237=======
Content-Type: text/plain; x-avg-checked=avg-ok-5A831DF4; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 8bit
At 02:52 PM 10/10/2002 -0400, you wrote:
I have a table which has multiple unique columns on it. My problem is that
when I insert a row which violates the unique restraint, I can't figure out
which column caused the problem.
Just a stab in the dark - but I am suspicious of a data model that requires
unique values in two (or more) columns. Can you verify that this is really
needed?.
Also are the users of the system providing these values directly?
You could :
select * from table where unique-column1 = proposed-new-value1
select * from table where unique-column2 = proposed-new-value2
If you get a row in either case then you know the corresponding new value's
already in use,
Bob Gailer
mailto:ramrom@earthling.net
303 442 2625
--=======656C2237=======--