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
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.
- Edited by KevinNicholas Sunday, February 12, 2012 9:30 PM
- Proposed As Answer by Peja TaoModerator Tuesday, February 14, 2012 6:14 AM
- Marked As Answer by Peja TaoModerator Monday, February 20, 2012 1:36 AM
All Replies
-
Sunday, February 12, 2012 8:29 PMModeratorAre 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
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.
- Edited by KevinNicholas Sunday, February 12, 2012 9:30 PM
- Proposed As Answer by Peja TaoModerator Tuesday, February 14, 2012 6:14 AM
- Marked As Answer by Peja TaoModerator Monday, February 20, 2012 1:36 AM

