BUG: sp_dropuser Fails to Drop a User Who Is Also a dboLast reviewed: May 5, 1997Article ID: Q93414 |
The information in this article applies to:
SYMPTOMSThe system stored procedure sp_dropuser does not drop a user in the current database if the user's login happens to be a dbo in other databases, even if the user is only a regular user in the current database. Consider the following scenarios: Assume you have two databases A and B, and a login name Joe. Joe is a regular user in database A, named Joe_A. Joe is also a dbo in database B. When the dbo in database A tries to drop Joe_A using sp_dropuser, the following error from the stored procedure will result:
You can't drop a database owner.This is an incorrect behavior, because Joe_A is not a dbo in database A.
CAUSESQL Server incorrectly checks the conditions in the system stored procedure sp_dropuser. The code for this system procedure checks if the user to be dropped is a dbo using the following query:
If exists (select * from sysdatabases where suid = @suid) begin print ("You can't drop a database owner") return(1) endIf the stored procedure were for dropping a login name, the above condition would be correct. The correct condition should be:
if @uid = 1 begin print(......) return(1) end WORKAROUNDTemporarily change the dbo in the other database to a different login name other than the user to be dropped.
STATUSMicrosoft has confirmed this to be a problem in SQL Server version 4.2a for OS/2. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
|
Additional query words:
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |