Delete database users in SQL Server2005

Source: Internet
Author: User
Tags microsoft sql server

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.