悉野小楼

导航

Sql 更新一列为行号

update employee
set emp_id=t1.rowId
from
(
--select * from 
--(
select Emp_UserName,ROW_NUMBER() over(Order by emp_username) as rowId
from employee
) as t1
where t1.Emp_UserName=employee.Emp_UserName
--) as t

 http://social.msdn.microsoft.com/Forums/zh-CN/sqlserverzhchs/thread/6160088e-524f-412c-93be-e7686ba05be0/

posted on 2012-06-11 22:06  悉野  阅读(3162)  评论(0编辑  收藏  举报