andy_tigger

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
WITH 表1 AS
(
SELECT 编号字段名, ROW_NUMBER() OVER(ORDER BY 排序字段名 DESC) AS RowNum 
FROM 表名
)
UPDATE 表1
SET 编号字段名=RowNum 
WITH uinfo AS
(
SELECT orderid, ROW_NUMBER() OVER(ORDER BY grade DESC) AS rowid 
FROM userinfo
)
UPDATE uinfo   
SET orderid=rowid
posted on 2011-05-09 14:22  andy_tigger  阅读(2557)  评论(1编辑  收藏  举报