DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004
    Location
    Alexandria, VA
    Posts
    392

    Adding users to SQL-Server

    Our product uses MSDE or MS-SQL Server 2K. It does not use SQL logins - it is strictly NT logins. Our product DB has a Users table that contains all the NT logins that have permission to use the product.

    I have written a stored procedure that grants new users permission to the SQL-Server, grants them permissions to the DB, adds them to a role (to grant them permission to the objects they'll need) and then adds them to the product's Users table. I use the sp_GrantLogin and sp_GrantDBAccess stored procedures to perform those first two steps.

    The problem occurs if the user already has permissions to the SQL-Server or the DB because of an alias, or because they are members of a group that has permissions (such as the local Administrators group). The two stored procedures above will throw an error if this occurs. However, the result is only pass/fail (0 or 1), so I can't tell programmatically if the failure is due to the user already being in the system (due to an alias) or for some other reason.

    How can I test (using SQL Script) to see if an NT Login already has permissions to the server and to a particular DB?

    Thanks...
    Bob Rouse
    Dimension Data

  2. #2
    Join Date
    Jan 2004
    Location
    Alexandria, VA
    Posts
    392
    Let me simplify the question...

    When executing "sp_GrantLogin", I get an error: "The login already has an account under a different user name"

    How can I find out what that other user name is?

    Thanks,
    Bob Rouse
    Dimension Data

Similar Threads

  1. find version & service packs
    By rperez in forum Database
    Replies: 5
    Last Post: 01-02-2009, 04:14 PM
  2. SQL Server Developer in Calgary Canada
    By Dan Staggs in forum Careers
    Replies: 0
    Last Post: 08-07-2002, 11:04 AM
  3. Changing Server Name
    By Levi Nkata in forum Database
    Replies: 3
    Last Post: 04-11-2001, 09:31 AM
  4. SQL Server Agent wont auto start
    By David Hay in forum Database
    Replies: 2
    Last Post: 04-02-2001, 07:11 PM
  5. SQL Server # of users?
    By sb in forum VB Classic
    Replies: 2
    Last Post: 08-31-2000, 10:34 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links