Tuesday, January 29, 2013

SQL error 15138

Today I have faced a problem which is might be help full some of buddies who is new like me ...:)


I create a user in SQL db and assigned a schema dbdatareader . 


But when I will try to delete the user I am facing some issue.

So my work around this :

 Run this query first :-

USE <dbname>;
SELECT s.name
FROM sys.schemas s
WHERE s.principal_id = USER_ID('username');

Run this 2nd query :-

ALTER AUTHORIZATION ON SCHEMA::db_datareader TO dbo;

Help link :
http://blog.sqlauthority.com/2011/12/26/sql-server-fix-error-15138-the-database-principal-owns-a-schema-in-the-database-and-cannot-be-dropped/

No comments:

Post a Comment