select replace(substring(DistinguishedName, 1, charindex(',', DistinguishedName)-1), 'CN=', '') 企 , SamAccountName ID , mail , cn , co from OPENROWSET( 'ADsDSOObject' , 'User ID=覃\螻;Password=れ;ADSI Flag=0x11;Page Size=10000' , 'select SamAccountName, DistinguishedName, mail, cn, co from ''LDAP://覃/OU=れ,OU=OU,DC=覃,DC=COM''' ) a where 1=1 and DistinguishedName like '%伎%'