The database principal owns a schema in the database, and cannot be dropped

Fix: Error: 15138 – The database principal owns a schema in the database, and cannot be dropped

If you try to drop a user that owns a schema, you will receive the following error message:

The database principal owns a schema in the database, and cannot be dropped.
In order to drop the user, you need to find the schemas they are assigned, then transfer the ownership to another user or role.

SELECT s.name

FROM sys.schemas s

WHERE s.principal_id = USER_ID(‘<USER_Name>’)

— now use the names you find from the above query below in place of the SchemaName below

ALTER AUTHORIZATION ON SCHEMA::SchemaName TO dbo


답글 남기기

댓글을 게시하려면 다음의 방법 중 하나를 사용하여 로그인 하세요:

WordPress.com 로고

WordPress.com의 계정을 사용하여 댓글을 남깁니다. 로그아웃 /  변경 )

Facebook 사진

Facebook의 계정을 사용하여 댓글을 남깁니다. 로그아웃 /  변경 )

%s에 연결하는 중