13

I am trying to add a new user to an SQL Server 2012 database using SQL Server Management Studio. I right-click and select 'Add User' under Security -> Users, fill out the user information, and click OK. Management Studio throws the the error message "is not a valid login or you do not have permission”.

How can I add this user?

  • 1
    This question has the same error message as this other question, but happens during normal administration rather than during installation. It looks like there are different causes and answers, so I'm posting this as a separate question. – culix Sep 18 '14 at 13:06
16

Before adding a User you must first create a global Login, under Security -> Logins. Once the login exists you can add them as a User under a particular database.

1

If you are trying to create a user under the Contained database user model (so no global login for it), you have to provide a password during creation like this:

CREATE USER user_name WITH PASSWORD = 'strong_password';
0

This worked for me :

CREATE USER [chris23] FROM LOGIN [##MS_PolicyEventProcessingLogin##];
EXEC sp_addrolemember N'db_datareader', 'chris23';
GO

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.