SQL2005提供了新函数:ROW_NUMBER()
以下为示例:
select ROW_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)
'' 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)
相关文章
暂无评论...