Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

T-SQL to LDAP Queries

Status
Not open for further replies.

djtech2k

MIS
Jul 24, 2003
1,097
US
I am interested in trying T-SQL to query AD and dump data to some tables for historical use.

I do have some queries running and working but I need to change them and am having troubles.

1) I want to use a query as a stored procedure. For example, i want a user lookup. So, you would create and then call a custom SP like "sp_Lookup_User 'username'". To do that I am obviously passing a variable. I have created it 1000x and it either errors when creating the procedure or does create it but returns no results when i run it. Why is that and how can I write an LDAP lookup as a stored procedure and pass it a variable.

2) I noticed that there is some sorta limit of 1000 returned rows with a T-SQL query of LDAP. Any idea how to change it?

I am using SQL 2000 Enterprise Manager/Query Analyzer.

Thanks!
 
I have gotten some code to work, but ultimately putting it into a stored procedure and passing it a variable is not working. I think I have syntax incorrect somewhere.
 
There is no way to remove the limit of 1000 records. That's a limit that AD has on it so that you don't overload AD when pulling records from it.

You can use dynamic SQL to generate the query that you need.

This should be reposted in the forum183 forum.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

My Blog
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top