Subject | Re: [firebird-support] Violation of UNIQUE KEY constraint during UPDATE |
---|---|
Author | Ann W. Harrison |
Post date | 2005-08-05T17:51:23Z |
Milan Babuskov wrote:
by row is a nuisance, but the double update is significantly more expensive.
Regards ,
Ann
>I'd go for the procedure - sorting the whole table then updating it row
>>UPDATE MY_TABLE SET IX = IX + 1 (if IX is a unique integer key, and
>>the table contains a continuous sequence of values for IX)
>>
>>Isn't there any way at all to shift a sequence of
>>unique values with one UPDATE-Statement?
>
>
> With one, no. But you could try with two. Suppose that you have some
> large values (ex. 10000+) that aren't taken:
>
> update my_table set ix = ix + 10001;
> update my_table set ix = ix - 10000;
>
by row is a nuisance, but the double update is significantly more expensive.
Regards ,
Ann