Link to home
Start Free TrialLog in
Avatar of rwheeler23
rwheeler23Flag for United States of America

asked on

SQL claims users do not exist when they do.

I wanted to grant access to a table to a user so I exeuted this:
GRANT SELECT,UPDATE,INSERT on [MyDB].[dbo].[MyTable] TO MyUser

Which returned this message:
Cannot find the user 'MyUser', because it does not exist or you do not have permission.

I then ran this:
EXEC sp_change_users_login @Action='update_one', @UserNamePattern='MyUser',    @LoginName='MyUser';

Which returned this:
Terminating this procedure. The User name 'MyUser' is absent or invalid.

I am logged in as 'sa' and 'MyUser' is a valid SQL user.

I have checked other SQL users and they fail the same way.

What is wrong here and do I fix this?
ASKER CERTIFIED SOLUTION
Avatar of Brian McDonald
Brian McDonald
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rwheeler23

ASKER

EXEC sp_change_users_login 'report'  Returns no users

I just tried the GRANT command again and it worked. The difference now is most users have gone home and the load on this old server is much lighter.
If they were in the system it'd probably block adjustments to their user permissions, because of active use. So that makes sense.
A more accurate message would have been helpful.
Thanks