我在我的SQL 2000服务器上恢复了一个名为R1的数据库。 我去添加R1到JUNO用户的用户映射。 我收到一个错误:
User or role 'JUNO' already exists in the current database.
所以我跑在R1上,我跑了SA:
DROP USER JUNO
得到:
Incorrect syntax near the keyword 'USER'.
所以我试了一下:
EXEC dbo.sp_revokedbaccess N'JUNO'
另一个错误:
Msg 15183, Level 16, State 1, Procedure sp_MScheck_uid_owns_anything, Line 17 The user owns objects in the database and cannot be dropped. Msg 15284, Level 16, State 1, Procedure sp_MScheck_uid_owns_anything, Line 34 The user has granted or revoked privileges to the following in the database and cannot be dropped.
我的目标不是放弃JUNO,而是允许JUNO访问数据库。 使用不同的用户名不是一个选项。
有任何想法吗?
看起来像这样做的窍门:
sp_change_users_login 'Update_One', 'JUNO', 'JUNO'