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?