解决删除用户时报错的问题:Msg 15138, Level16, State 1, Line 1 The database principal owns a schemain the database, and cannot be dropped.

USE mydata;
 SELECT s.name
 FROM sys.schemas s
 WHERE s.principal_id= USER_ID('developer');
 
--将db_owner Schema的Owner改为dbo
ALTER AUTHORIZATION on SCHEMA::db_owner TO dbo;
 
---再次查询用户test6拥有的Schema为空
 SELECT s.name
 FROM sys.schemas s
 WHERE s.principal_id= USER_ID('developer');
 
 --删除用户test6
 DROP USER developer

 

posted @ 2013-05-21 18:39  Rick Sun  阅读(288)  评论(0编辑  收藏  举报