0
(0)

Problem Description:

Usually we face this issue while dropping user from database which owns database schema and error code 15138 indicates issue of database schema which need to be modified.

Solution:

Run below query on database to check database roles owned by that user which need to be removed.

use <dbname>
go
select s.name from sys.schemas s where s.principal_id=user_id('username')
go

get the schema name from above query and pass it to below query.

use <dbname>
go
alter authorization on schema::[schemaname] to [dbo]
go

once schema name is changed to dbo, you can now drop the user from the database.

use <dbname>
go
exec sp_dropuser <username>
go

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.