【Vegas原创】select时,一个栏位按123进行编号的方法
原创
©著作权归作者所有:来自51CTO博客作者李济宏Amadeus的原创作品,请联系作者获取转载授权,否则将追究法律责任
SQL2005提供了新函数:ROW_NUMBER()
以下为示例:
selectROW_NUMBER() OVER(ORDER BY sAMAccountName DESC) as emp_no,
'' as card_no,sAMAccountName as ename,sn+givenname as cname,
'' as Gender,'' as departmentname,'' as job_Rank,telephoneNumber as ext,
Mail as email,'' as dlidl,'' as enter_date,'' as birth_date,'1' as workstate,'DTS' as domain
from [eipdb].webeip.dbo.ldap_account
where replace(sAMAccountName,' ','') not in
(select distinct replace(ename,' ','') from empBaseInfo)