I am attempting to update a sql table from an open query of active directory.
This throws an incorrect syntax error on "as tblAdsi"
update adAttrib
set adAttrib.telephoneNumber = tblADSI.telephoneNumber, adAttrib.facsimileTelephoneNumber = tblADSI.facsimileTelephoneNumber, adAttrib.employeeID = tblADSI.employeeID,
adAttrib.extensionAttribute1 = tblADSI.extensionAttribute1, adAttrib.l = tblADSI.l, adAttrib.department = tblADSI.department, adAttrib.mobile = tblADSI.mobile, adAttrib.mail = tblADSI.mail,
adAttrib.sAMAccountName = tblADSI.sAMAcountname, adAttrib.givenname tblADSI.givenname, adAttrib.sn = tblADSI.sn, adAttrib.displayName = tblADSI.displayName
from adAttributes2 adAttrib, (SELECT *
FROM OPENQUERY( ADSI,
'SELECT telephoneNumber, mail, mobile, facsimileTelephoneNumber, department, physicalDeliveryOfficeName, givenname, sAMAccountName, displayName, employeeID
FROM ''LDAP://DC=rrd,DC=gradw,DC=tryf''
WHERE objectCategory = ''Person'' AND
objectClass = ''User''')
where mail is not null and givenname is not null and employeeID is not null) tblADSI
where adAttrib.employeeid = tblADSI.employeeid
My searches say that the syntax should be correct?