来源:http://hi.baidu.com/xcrypt/blog/item/5e99f3fdf0b7481108244d7f.html / http://www.fileformat.info/tip/microsoft/sql_orphan_user.htm
中文版
解决方法是使用sp_change_users_login来修复。
sp_change_users_login的用法有三种
用法1:
exec sp_change_users_login 'REPORT'
列出当前数据库的孤立用户
用法2:
exec sp_change_users_login 'AUTO_FIX','用户名'
可以自动将用户名所对应的同名登录添加到syslogins中
如果没有建立testuser的登录用户,还可以用
sp_change_users_login 'Auto_Fix', 'testuser', NULL, 'testpass'
用法3:
exec sp_change_users_login 'UPDATE_ONE','用户名','登录名'
将用户名映射为指定的登录名。
英文版
First, make sure that this is the problem. This will lists the orphaned users:
EXEC sp_change_users_login 'Report'
If you already have a login id and password for this user, fix it by doing:
EXEC sp_change_users_login 'Auto_Fix', 'user'
If you want to create a new login id and password for this user, fix it by doing:
EXEC sp_change_users_login 'Auto_Fix', 'user', 'login', 'password' |