解决"the database principal owns a schema in the database and cannot be dropped"问题
2009-08-05 15:52 清炒白菜 阅读(1723) 评论(0) 编辑 收藏 举报摘自 http://www.cnblogs.com/autumn/articles/853442.html
TITLE: Microsoft SQL Server Management Studio
------------------------------
Drop failed for User 'SQL2K5User'. (Microsoft.SqlServer.Smo)
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
The database principal owns a schema in the database, and cannot be dropped. (Microsoft SQL Server, Error: 15138)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.3042&EvtSrc=MSSQLServer&EvtID=15138&LinkId=20476
解决方案:
1) Expand Schemas(should be like a folder under <yourdatabase> -> Security) .
2) Delete the unwanted "userSchema".
3) Then, go back to the User(a folder like thing) and delete it.
ps: select * from sys.schemas where principal_id = user_id('user_name')