debugsqlCritical
The database principal owns a schema in the database, and cannot be dropped message
Viewed 0 times
cannotthedroppedmessagedatabaseownsprincipalandschema
Problem
I am trying to delete a principal from the database but can't because it owns a schema. When I go to edit the user, however, the box to uncheck schemae is blue and unremovable. How can I remove the principal from these schemas?
Solution
Try the T-SQL to do this:
You can't drop a principal that is a schema owner, so the
alter authorization
on schema::YourSchemaName
to dbo
go
drop user TheUserYouWantToDelete
goYou can't drop a principal that is a schema owner, so the
ALTER AUTHORZATION changes the owned schema (I used YourSchemaName, but obviously substitute that with the owned schema in your database) to dbo (likewise, you can change ownership to whatever principal you need in your environment). That will allow you to drop the previously-schema-owning user (for example purposes I used TheUserYouWantToDelete, but that'll be the now non-owner that you want to drop).Code Snippets
alter authorization
on schema::YourSchemaName
to dbo
go
drop user TheUserYouWantToDelete
goContext
StackExchange Database Administrators Q#19456, answer score: 53
Revisions (0)
No revisions yet.