I'd look at a merge statement

merge into Turnover_Waiting_List O
using ( select Item_Name, Item_Type, Item_Attribute,
​ ​
Wait_Sequence
​,
row_number() over(order by
Item_Name, Item_Type, Item_Attribute,
​ ​
Wait_Sequence
​) * 10 as new_seq
​ ) as N
​on n.item_name = o.item_name
and n.item_type = o.item_type
and n.item_attribute = o.item_attribute
and n.wait_sequence = o.wait_sequence
when matched
update
set wait_sequence = n.new_seq

Charles​





On Tue, Mar 29, 2016 at 12:04 PM, <dlclark@xxxxxxxxxxxxxxxx> wrote:

Basically, what I am trying to accomplish is to resequence, in
place, a numeric column from 10 by 10. This is used in a priority list
where an entry's priority can change. Thus, for example, if there are 5
entries in a particular group and the entry at priority 30 is changed to
priority 5, I then want to resequence that group of entries from 10 such
that the changed entry will remain with the highest priority of 10 --
i.e., raising it from 30 to 10 -- and moving all other entries in the
group down by 10 for each existing entry. I've been able to resequence
the column but I have not been able to resequence according to the new
priority sequence -- rather, it resequences by the primary identity key no
matter what I try (as shown in the example below). How can I accomplish
this?

Alter Sequence TEMP_SEQ Restart with 10;

Update Turnover_Waiting_List
Set Wait_Sequence = NEXT VALUE FOR TEMP_SEQ
Where TOWAITLT_ID IN (Select TOWAITLT_ID
From Turnover_Waiting_List
Where Item_Name = 'TOWAITBRSM'
And Item_Type = '*MODULE'
And Item_Attribute = 'SQLRPM'
Order by Item_Name, Item_Type, Item_Attribute,
Wait_Sequence)
With NC;

Sincerely,

Dave Clark
int.ext: 91078
direct: (937) 531-6378
home: (937) 751-3300

Winsupply Group Services
3110 Kettering Boulevard
Dayton, Ohio 45439 USA
(937) 294-5331




*********************************************************************************************
This email message and any attachments is for use only by the named
addressee(s) and may contain confidential, privileged and/or proprietary
information. If you have received this message in error, please
immediately notify the sender and delete and destroy the message and all
copies. All unauthorized direct or indirect use or disclosure of this
message is strictly prohibited. No right to confidentiality or privilege
is waived or lost by any error in transmission.

*********************************************************************************************
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.