create table #(id int)
insert into #
select 86715
union all select 86716
union all select 86717
union all select 86718
union all select 86719
union all select 86720
union all select 86721
union all select 86722
union all select 86723
union all select 86725
union all select 86726
union all select 86727
union all select 86730
union all select 86731
union all select 86732
union all select 86733
union all select 86734
union all select 86735
union all select 86740
union all select 86743
union all select 86746
union all select 86747
union all select 86749
union all select 86750
union all select 86751
union all select 86752
union all select 86754
union all select 86756
union all select 86757
union all select 86758
union all select 86759
union all select 86760
union all select 86761
union all select 86762
union all select 86763
union all select 86764
union all select 86766
--语句
select top 4 * from # t1
where id <> 86727
order by (select count(1) from # where id > t1.id and id < 86727 or id < t1.id and id > 86727 )
--结果
86726
86730
86725
86731
修改一下
--与1最临近的记录为
select top 4 * from tablename where columnname <> 1 order by abs(columnname - 1)
--与4最临近的记录为
select top 4 * from tablename where columnname <> 4 order by abs(columnname - 4)