SQL Server > SQL Server Forums > SQL Server Security > db_adduser 'builtin\users' errors but adds user anyway

Answered db_adduser 'builtin\users' errors but adds user anyway

  • Sunday, February 12, 2012 8:26 PM
     
     

    I added BUILTIN\Users group as a SQL Login and then tried adding it as a user to a database with:

      db_adduser 'builtin\users'

    It generates this error, but seems to add it anyway:

      Msg 15007, Level 16, State 1, Procedure sp_adduser, Line 15
      'builtin\users' is not a valid login or you do not have permission.

    Any idea what gives?

    Thanks.

Answers

  • Sunday, February 12, 2012 9:08 PM
     
     Answered

    sp_adduser will not work with groups.

    You could use

    CREATE USER [BUILTIN\Users] FROM LOGIN [BUILTIN\Users]

    Edit:

    If you have a look at sp_helptext sp_adduser you'll see there is a check for isntuser or isntname and this is raising the 15007 msg you are seeing.

All Replies

  • Sunday, February 12, 2012 8:29 PM
    Moderator
     
     
    Are you sure its added in the database where it was not present earlier? I am unable to reproduce.

    Balmukund Lakhani | Please mark solved if I've answered your question, vote for it as helpful to help other user's find a solution quicker
    --------------------------------------------------------------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
    --------------------------------------------------------------------------------
    My Blog | Team Blog | @Twitter

  • Sunday, February 12, 2012 9:08 PM
     
     Answered

    sp_adduser will not work with groups.

    You could use

    CREATE USER [BUILTIN\Users] FROM LOGIN [BUILTIN\Users]

    Edit:

    If you have a look at sp_helptext sp_adduser you'll see there is a check for isntuser or isntname and this is raising the 15007 msg you are seeing.