Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Querying Active Directory with SQL 2005
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

United Kingdom
2 Posts

Posted - 02/21/2013 :  13:32:12  Show Profile  Reply with Quote
Good evening

I'm a SQL Server DBA/Developer of about 12 years' standing, but I've come across a need to do something new and I'm hoping that someone out there will be able to help me.

We run some web-based software which is back-ended with a series of SQL databases, on a 2005 Standard installation. At the moment, if I need to grant access to that system to a user or users, I need to do so manually.

The backbone of the system is a users table which contains as one of its columns the login name for every user that needs access to the system (minus the domain name). Rather than me having to manually create all of the users, I'd like to be able to query an Active Directory group and use the results from that query to automatically populate the users table. However, I'm really struggling to find the relevant SQL to make that possible. I've found a number of resources online that claim to provide the code but I can't make it work.

Can anyone provide me with a simple (and if necessary step-by-step) instruction on setting this up?

Thanks in advance.

Ian Henderson
BI Developer

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 02/21/2013 :  14:28:45  Show Profile  Reply with Quote
The links on this page are pretty good - if you have not already visited it, please try that:

If you don't have to have the list of users in the database for other purposes, the ideal way to do this in my mind would be to create an AD group of which all the authorized users are members of, add the AD group as a login and user on the database, and grant the required privileges to that login/user. From then on, you would simply maintain the users in Active Directory; you would not need to touch the database.

But it sounds like that is not your situation - do you need the list of users in a table in the database for purposes other than granting them access to the database/objects?
Go to Top of Page

Posting Yak Master

191 Posts

Posted - 02/21/2013 :  15:50:14  Show Profile  Visit sanjnep's Homepage  Reply with Quote
May be this will help you....

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000