Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 20th, 2007, 12:16 PM
Registered User
 
Join Date: Mar 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default query active directory

im trying to select all the users that has a login to their machine at school, and these people have to be in a certain group ,in active directory. But i cant do it. If i select only user it works fine, but as soon as i put memberof='groupname' it gave back nothing. This is what i got
Code:
CREATE view View1
AS
select sAMAccountname, [name], physicalDeliveryOfficeName, givenName, userPrincipalName, cn, sn, mail, adsPath from openquery
(
ADSI,'SELECT sAMAccountName, name, physicalDeliveryOfficeName, givenName, userPrincipalName, cn, sn, mail, adsPath
FROM ''LDAP://mydomain''
WHERE objclass = ''user'' and memberOf='mystudent''
')
Go
select * from view1 order by adspath

drop view view1
the code above returns no records.

if i take out memberof i got many records.

if i put in
Code:
i got this code below from this site :http://technet2.microsoft.com/window....mspx?mfr=true

memberOf=''CN=...,OU...,DC...,DC....
then i got this error message
Server: Msg 7321, Level 16, State 2, Procedure View1, Line 3
An error occurred while preparing a query for execution against OLE DB provider 'ADSDSOObject'.
OLE DB error trace [OLE/DB Provider 'ADSDSOObject' ICommandPrepare::Prepare returned 0x80040e14].

can some on help me plz plz plz.
 
Old August 20th, 2007, 12:50 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 246
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try to put multiple single quote around the ''groupname'''
Single quote is used as escape character for string in SQL Server.


 
Old August 20th, 2007, 01:00 PM
Registered User
 
Join Date: Mar 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

didnt work either it gave me that error just like b4 about preparing.

 
Old August 21st, 2007, 02:12 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Can you show the query as it stands now?

--

Joe (Microsoft MVP - XML)
 
Old August 21st, 2007, 08:33 AM
Registered User
 
Join Date: Mar 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

huh? i did on the every first message the whole query is there.






Similar Threads
Thread Thread Starter Forum Replies Last Post
About Active Directory apalmero VB How-To 1 April 8th, 2005 04:06 PM
Active Directory - help! bubmachine General .NET 2 August 3rd, 2004 04:45 PM
About Active Directory apalmero VS.NET 2002/2003 1 November 9th, 2003 01:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.