Tuesday, 9 December 2008

Reconnect an SQL login to a user

Sometimes a user in a database gets disconnected from a server login and you can re-map the login to the database as the user is already there.

This usually happens after you restore a database to a server.

So the following gived you a report of all the disconnected users:

sp_change_users_login report

And this remaps a login(tramdba(server login)) to a user(tramdba(user))

sp_change_users_login update_one,<user>,<login>