先把向上的写个:
CREATE procedure UpPlace(
@ID int ,
@Place int
)
as
declare @count int
select @count = (select count(*) from Sy_Link where Link_Type=0 and Link_Sort < @Place)
if (@count >0)
begin
update Sy_Link set Link_Sort = link_Sort+1 where Link_Type=0 and link_sort = @Place-1
update Sy_Link set Link_Sort = link_Sort-1 where link_ID = @ID