删除 SQL Server 数据库中的角色?
我正在尝试删除 SQL Server 数据库中的角色之一。我删除了该角色中的所有成员,当我尝试删除角色时,我收到此错误消息:
Msg 15138, Level 16, State 1, Line 13
The database principal owns a schema in the database, and cannot be dropped.
有人知道为什么吗?我检查了拥有的架构,它只有自己的名称中的复选标记。
I am trying to drop one of the role in my SQL Server database. I dropped all the members from the role and when i tried to drop role i got this error message:
Msg 15138, Level 16, State 1, Line 13
The database principal owns a schema in the database, and cannot be dropped.
Does anyone know why? I checked the Owned Schema and it only had check sign in its own name.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
15138 错误是由于您尝试删除的用户拥有架构所致。
如果运行以下查询,您将获得用户拥有的架构。
假设它返回“db_denydatareader”模式。然后你可以分配
使用以下查询将该架构设置为默认用户“dbo”。
15138 error is due to the user you are trying to delete owns a schema.
If you run the below query you will get the schema owned by the user.
Let us say it returns 'db_denydatareader' schema. Then you can assign
that schema to default user 'dbo' using the below query.
您无法删除拥有架构的数据库主体。您必须将架构所有权转移给其他数据库主体或删除该架构,然后才能删除数据库主体。
You cannot drop a database principal that owns a schema. You have to transfer the schema ownership to some other database principal or drop the schema before you can drop the database principal.