We had a login with a mapped user for a particular database. We dropped that database (this is development environment, of course), and restored a copy of production which also has same user name.
Now, if developers want to connect to database from their application, they get an error. In SSMS, I could find that login - it was not checked - and I tried to check it to the database. However, I got an error stating that this user already exists in the database. I had to drop the user from database, and after that I could map the login. But dropping is not a solution, there must be more elegant way for it. Is there any sp_ for that ? I tried sp_validatelogins but this is not what I want.
Thanks