[EMAIL PROTECTED] wrote:

Hello,

My application requires records in a table to be arrange in order. I am uisng ID (Integer Primary Key) filed to keep track order.

When I want to insert a record between some records, I am trying to do following SQL:
------
update pb_transactiondetail set ID = ID + 1 where ID >10; (Error: PRIMARY KEY must be unique , 0 rows effected.)
insert pb_transactiondetail values(10, ....);
------


I understand why I get that error, but I want to know if there is way to around this error? For example update ID desc order? Any script can do this.


Thank you in advance.

Ming


you can try
update pb_transactiondetail set ID = ID + 1 where ID in (select id from pb_transactiondetail where ID >10 order by id desc);


John

Reply via email to