>>CREATE PROCEDURE [omcountry_moveto] @lcAction CHAR(10), @lcCurIdKey >> UNIQUEIDENTIFIER, @lcNewIdKey UNIQUEIDENTIFIER OUTPUT AS >>DECLARE omcountry_cursor CURSOR SCROLL FOR SELECT idkey FROM omcountry ORDER BY code >>OPEN omcountry_cursor >>IF (@lcAction = 'TOP') >>BEGIN >> FETCH FIRST FROM omcountry_cursor INTO @lcNewIdKey >>END >>IF (@lcAction ='BOTTOM') >>BEGIN >> FETCH LAST FROM omcountry_cursor INTO @lcNewIdKey >>END >>IF (@lcAction = 'NEXT') >>BEGIN >> FETCH NEXT FROM omcountry_cursor INTO @lcNewIdKey >>END >>IF (@lcAction = 'PREV') >>BEGIN >> FETCH PRIOR FROM omcountry_cursor INTO @lcNewIdKey >>END >>CLOSE omcountry_cursor >>DEALLOCATE omcountry_cursor >>>>The top and button part works fine. But how do I do with NEXT and PREV? I must first stand in the right position before I can do the FETCH command and how do I do that in the best way? I hope a WHILE loop with repeated FETCH NEXT is not the only way to walk...