--查询行号

select row_number()over(order by CHECKTIME )as RowNum,*from CHECKINOUT

 

--更新id列为行号

update CHECKINOUT set id=t.rowId from
(select CHECKTIME, ROW_NUMBER() over(Order by CHECKTIME) as rowId from CHECKINOUT ) as t
where t.CHECKTIME = CHECKINOUT.CHECKTIME

posted on 2015-01-15 14:16  小计天空  阅读(457)  评论(0编辑  收藏  举报