Jump to content

SQL error when setting "is not null"


aic007

Recommended Posts

I am queyring Active Directory by using linked server access (ADSI)I use this code to get data from ADselect sAMAccountName, givenname as 'First name', middleName as Initials, sn as 'Last name', displayName, telephonenumber as Telephone, mail as Mail, info as Remarks, title as Title, department as Department, company as Company, manager as Managerfrom openquery ( ADSI, 'SELECT sAMAccountName, givenname, middleName, sn, displayName, telephonenumber, mail, info, title, department, company, manager FROM ''LDAP://litwaredemo'' ')This works, but I get about 100 lines with only NULL in all columnsAnd then I tried to set is not NULL on all attributes ... ... ..... same code as before ....FROM ''LDAP://litwaredemo''WHERE sAMAccountName is not NULL AND givenname is not NULL AND middleName is not NULL AND sn is not NULL AND displayName is not NULL AND telephonenumber is not NULL AND mail is not NULL AND info is not NULL AND title is not NULL AND department is not NULL AND company is not NULL AND manager is not NULL ')But then I get this error"Msg 7321, Level 16, State 2, Line 4An error occurred while preparing the query "SELECT"Any ideas how could solve the problem with NULL's ?:-)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...