Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: UPDATE statement and unique constraints.



Hi Paul,

if you happen to knoiw 2 values that are definitely not present in the
table then you could do like this:

update test1 set col1='not_a_value1' where col2=1;
update test1 set col1='not_a_value2' where col2=2;
update test1 set col1='fred' where col2=1;
update test1 set col1='bob' where col2=2;

and yes, you could wrap that in BEGIN ATOMIC block

Theoretically, there is another option: if you cannot swap col1
values, then you could swap all the other columns in these two
records, I mean

update test1 set col2=value2_fromrec2, col3=value3_fromrec2 ... where
col2=1;
update test1 set col2=value2_fromrec1, col3=value3_fromrec1 ... where
col2=2;

good luck!



<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.