Here is some sample code to create a table and fully test this type of thing ... There are lots of ways to clean it up- but this should give you the general concept.
CREATE TABLE [dbo].[TestPri](
[Name1] [varchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Priority] [int] NOT NULL
) ON [PRIMARY]
GO
-- Populate Table
SET NOCOUNT ON
INSERT INTO TestPri (Name1, Priority) VALUES ('John', 1)
INSERT INTO TestPri (Name1, Priority) VALUES ('Hank', 2)
INSERT INTO TestPri (Name1, Priority) VALUES ('Suzy', 3)
INSERT INTO TestPri (Name1, Priority) VALUES ('George', 4)
INSERT INTO TestPri (Name1, Priority) VALUES ('Jackie', 5)
GO
ALTER PROC AlterPri
(
@OldPri int,
@NewPri int
)
AS BEGIN
SET NOCOUNT ON
-- If Increasing the Priority of a record..
IF @OldPri > @NewPri BEGIN
--Modify the record we're changing..
UPDATE TestPri SET Priority = (@NewPri-1) WHERE Priority = @OldPri
-- add +1 to each record prior to it's old setting
UPDATE TestPri SET Priority = (Priority+1) WHERE Priority < @OldPri
-- If Decreasing the Priority of a record..
END ELSE IF @OldPri < @NewPri BEGIN
--Modify the record we're changing.. add an additional +1 because on the
-- next query it will subtract it
UPDATE TestPri SET Priority = (@NewPri+1) WHERE Priority = @OldPri
-- minus 1 to each record prior to it's old setting
UPDATE TestPri SET Priority = (Priority-1) WHERE Priority > @OldPri
END
SELECT * FROM TestPri ORDER BY Priority
END
GO