Error Querying Active Directory Linked Server from SQL Server 2008 R2 -


i'm developing part of application requires sql server 2008 r2 query active directory. i've done far create linked server doing

exec sp_addlinkedserver 'adsi_link', 'active directory service interface', 'adsdsoobject', 'adsdatasource' exec sp_configure 'show advanced options',1 go     reconfigure go     exec sp_configure 'ad hoc distributed queries',1 go     reconfigure go 

doing exec sp_linkedservers shows linked server active directory created. next step users active directory database. doing open query following returns users should no errors or issue whatsoever. basically, works following query.

select * openquery (adsi_link,     'select cn, givenname, sn, objectcategory, samaccountname, mail, department, manager, ou, useraccountcontrol, lockouttime         ''ldap://dc=domain,dc=local''         objectcategory = ''person''         , objectcategory = ''user''         , objectcategory <> ''computer'' ') department <> '' , not(useraccountcontrol & 2 <> 0) -- works fine out here 

however, if move statements in "outer" clause 1 "inner" one, shown below, "msg 7321, level 16, state 2, line 1" error.

select * openquery (adsi_link,     'select cn, givenname, sn, objectcategory, samaccountname, mail, department, manager, ou, useraccountcontrol, lockouttime         ''ldap://dc=domain,dc=local''         objectcategory = ''person''         , objectcategory = ''user''         , objectcategory <> ''computer''         , department <> '''' , not(useraccountcontrol & 2 <> 0) -- adding line throws error ') 

i'd know causing error second query, , can done allow work.

thank in advance , advice!


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -