Script adding an NT-user group (as a user as opposed to an individual user) to a database

  • With SQL Server 2000/2005, I want to script adding an NT-group-user to a database and then i want to assign that NT-group to a specific role in that database.

    For a specific user this is easy:

    sp_adduser @loginame = 'domainA\userA', @grpname = 'roleA'

    This works fine for an individual user.

    But if i try this for an NT-group:

    sp_adduser @loginame = 'domainA\groupA', @grpname = 'roleA'

    i get the message "The login 'domainA\groupA' does not exist."

    Obviously I HAVE already added both the user and the NT-group to the server itself as users before i try to run the sp_adduser stored proc, i.e. the following two logins have already been added to the server:

    domainA\userA

    domainA\groupA

    Please HELP ...

  • Try this...

    sp_grantlogin [@loginame =] 'login'

    ---------------------------------------------------
    "Thare are only 10 types of people in the world:
    Those who understand binary, and those who don't."

  • thank you.

    I ended up using:

    CREATE USER [domainA\groupA] FOR LOGIN [domainA\groupA]

    and then used sp_addrolemember to assign a the group to a role

    Its amazing how many different stored procedures there are that essentially do the same thing...

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply