It is easy to delete database users in SQL Server. You only need to delete the database directly or use the Drop User command. However, direct operations in SQL Server are not acceptable, this is because the architecture in SQL Server 2005 is treated as an entity. To delete a user, you must first delete the user's schema or change the owner of the schema. Otherwise, the system prompts "the database subject has a schema in the database and cannot be deleted.
After searching, we know that each database user corresponds to one system login account, and each architecture can only be assigned to one user. Therefore, it is not possible to directly delete the user's architecture. Then I create a new login name and pay the db_owner architecture to the user ing. Then, I can delete the previous user.
When a user is deleted in SQL SERVER2005, the error "the database entity has a schema in the database and cannot be deleted" is returned.
The prompt is as follows:
"The database subject has a schema in the database and cannot be deleted. (Microsoft SQL Server, error: 15138 )"
Solution:
You only need to delete the corresponding architecture (with the same username) in the database security-architecture, and then you can delete the user.