Reputation: 39190
I'm running the following script and receive no errors nor warnings. I also verify that the user actually has been created. When I click on it, I get to see the roles (the membership db_owner is checked).
create login normalLogin
with password = 'normalpass',
check_policy = off
create login adminLogin
with password = 'adminpass',
check_policy = off
create user common for login normalLogin;
create user admin for login adminLogin;
execute sp_addrolemember db_owner, admin
However, when I try to log in to the server using admin as user name and adminpass as password (SQL authorization), I get the error message telling me this.
Login failed for user 'admin'. (Microsoft SQL Server, Error: 18456)
Accessing the helping link, I get two feasible suggestions.
I'm certain that (1) is correct (still, how can I re-check it?) so the suspicions fall on (2). Is the script above insufficient? I have the feeling that maybe the user on DB level isn't enough and that I need to create it on server level. Is it so? How can I script such an operation? I wish, of course, to keep the security tight and compartmentalized.
Upvotes: 0
Views: 3321
Reputation: 1428
Can you try this:
Upvotes: 4