From: http://hi.baidu.com/momodetang/blog/item/8ffe01fdb3a7eb4fd6887dbb.html
Due to mssql2000 database errors, I restored an original database to the current SQL statement. Now I came to the user and wanted to delete the restored user, the result shows that "the selected user cannot remove this user because the user has an object ":
If the user cannot be deleted, I am going to add the user in the system to this database to see if it is OK, but the following error is prompted (Microsoft SQL-DMO window ):
Error 21002: [SQL-DMO] user "liuhui" already exists.
Because of business requirements, I cannot create a new user for it or for another user. This database can only be used by this user, and the standard and Standard Server Format cannot be broken, it will not bring about the super trouble of future maintenance, and there is no way to ask for help from Google and Baidu. The result is unknown, and they let me down. There is no way, so I have to ask for help from an experienced friend and solve the problem, this technology is not a secret, and I will not tell the average person:
1. Open the Enterprise Manager, expand the server, right-click the local server,Attribute:
Open the SQL Server properties (configuration) window
2. SelectGeneralWindow, SetEnable SQL Server proxy automaticallySelected
OK
3. Repeat Action 1. Open and openSQL Server properties (configuration) window, Select the server settings window:
SetAllows direct modification of System DirectoriesSelect, OK.
4. Expand the database, view the database system table sysusers, right-click --Open Table--Returns all rows.:
5. Select the user to be added for restoration, find the relevant row, right-clickDelete:
SelectYes
Go back to the user list and check whether there is any user. If there is no user, add the user corresponding to the database in SQL security. I added liuhui, the test is okay.
Return Action 3.Allows direct modification of System DirectoriesRemove
You can also delete this user by using the following method, and change all the owner objects in the data table to DBO. It is no longer a problem to delete the user.