SQL error 15138 is usually associated with a user who owns a schema possessing database roles.
As part of our Server Support Services, we help numerous customers to resolve sql related issues.
In this Context we shall discuss about how to solve this error.
To solve this sql issue, we can apply 2 different approaches which are through SSMS client or with T-SQL script.
Using this method, you should first go to the Object Explorer to connect to the Target Server. Then expand the target database where you will see the Security tab. Next, Expand the security tab and the Schema respectively. Here right click on the schema you intend to to change. In our case our username was "name_of_user". Do change it to "dbo" to fix this error.
This method is the easiest and it involves transferring ownership of the schema "name_of_user" to "dbo". The following command will do the job;
ALTER AUTHORIZATION ON SCHEMA::[name_of_user] TO [dbo]
After successfully executing the above script, then you can proceed with dropping the user without any further issues.
SQL error 15138 occurs when trying to drop an orphaned user from an obsolete login.