Microsoft SQL Server Error: 15138 failed to delete the database because the database owner has a schema in the database and cannot delete the database. Solution
An error occurred while deleting the *** user. (Microsoft. sqlserver. SMO)
Click: http://go.microsoft.com/fwlink? For help information? Prodname = Microsoft + SQL + server & prodver = 9.00.1523.00 & evtsrc = Microsoft. sqlserver. Management. SMO. exceptiontemplates. failedoperationexceptiontext & evtid = Delete + User & linkid = 20476
------------------------------
Other information:
An exception occurred when executing a Transact-SQL statement or batch processing. (Microsoft. sqlserver. connectioninfo)
------------------------------
The database entity has a schema in the database and cannot be deleted. (Microsoft SQL Server, error: 15138)
Click: http://go.microsoft.com/fwlink? For help information? Prodname = Microsoft + SQL + server & prodver = 09.00.1399 & evtsrc = MSSQLServer & evtid = 15138 & linkid = 20476
Solution 1
Delete the schema of the user, and then delete the corresponding user
Procedure
1. SQL Server Management studio -- database -- Security -- Architecture, first Delete the corresponding Architecture
2. SQL Server Management studio -- database -- Security -- user, delete corresponding user
Solution 2
-- Execute the following SQL statement
Alter authorization on Schema: db_owner to DBO;
-- Then manually delete it.
(Original from: http://www.543.com.cn/post/54.html)