I want to create new menuitem: Contact with sequence value: 3.
How do i change menuitem History to sequence 4 and Information to sequence 5 when adding menuitem contact??
i use PHP with Sql Server 2008 (with an ODBC Connection).
Table = MenuItems
Rows: Sequence::Menuitem
1::Home
2::Photo
3::History
4::Information
After creating menuitem: Contact
1::Home
2::Photo
3::Contact
4::History
5::Information
Update the table items after insert:
UPDATE MenuItems SET Sequence = Sequence + 1 WHERE Sequence >= 3 AND MenuItem != 'Contact'
This adds 1 to every sequence number to the menus after Contact.
Assuming that you know where the new item landed:
update MenuItems
set Sequence += 1
where Sequence >= @NewItemSequence and Id <> @NewItemId