2012年3月20日
摘要: 先考虑按SortId降序排列的情况。初始状态SortId=Id方案1,首先获取当前最大的SortId,例如:@MaxSid = 100其次,将要置顶的行重新升序排列放入表变量里,并添加一列序号列select row_number() over(order by sortid) as NId,Id,SortId from T_Test where id in(11,22,33,44)order by sortid 结果:NIdIdSortId11111222223333344444然后,计算出新的SortId=@MaxSid+NIddeclare @t table(nid int,id int) 阅读全文
posted @ 2012-03-20 13:20 人在做,人在看 阅读(781) 评论(1) 推荐(0) 编辑