Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2007
    Posts
    3

    Unanswered: get data from Active Directory to MS SQL Server

    I look for and try to get data from Active Directory to MSSQL Server, but have same error:

    Msg 7321, Level 16, State 2, Line 1
    An error occurred while preparing the query "SELECT name
    FROM 'LDAP://office.experter.group'
    WHERE objectCategory = 'Person' AND objectClass = 'user'" for execution against OLE DB provider "ADsDSOObject" for linked server "ADSI".

    for the code:

    select * from openquery
    (
    ADSI,'SELECT name
    FROM ''LDAP://office.experter.group''
    WHERE objectCategory = ''Person'' AND objectClass = ''user'''
    )

    I create linked server:

    EXEC master.dbo.sp_addlinkedserver @server = N'ADSI',
    @srvproduct=N'Active Directory Services', @provider=N'ADsDSOObject',
    @datasrc=N'office.experter.group'

    I've changed security setting, format of LDAP. Please advise me

  2. #2
    Join Date
    Jan 2003
    Location
    Nottinghamshire, UK
    Posts
    364
    Have you considered using the TSQL IS_MEMBER Function ?

    ie.
    Code:
    IF IS_MEMBER ('ADVWORKS\Shipping') = 1
       SELECT 'User ' + USER + ' is a member of ADVWORKS\Shipping.'
    Works quite well with AD Security Groups

    GW
    "Everything should be made as simple as possible, but not simpler." - Albert Einstein
    "Everything should be made as complex as possible, so I look Cleverer." - Application Developer

  3. #3
    Join Date
    Jun 2007
    Posts
    3
    thanks, but where i must use it? and what to do if i want to do access without secury option?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •