Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 delete a user with schema

Author  Topic 

allan8964
Posting Yak Master

249 Posts

Posted - 2012-10-03 : 11:58:51
Hi there,

I tried to delete a test user but got error as:

The database principle owns a shema in the database, and cannot be dropped.

What should I do to remove this user account?
Thanks in advance.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-10-03 : 12:12:24
first drop schema and then delete the user



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

allan8964
Posting Yak Master

249 Posts

Posted - 2012-10-03 : 12:35:38
thanks. but how?
now the user is ABC and schema is db_owner. should i use revoke?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-10-03 : 12:47:12
db_owner is not a schema its a database role

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

allan8964
Posting Yak Master

249 Posts

Posted - 2012-10-03 : 16:01:25
I did some search and tests ... better way is transfer the ownership of schema db_owner from 'ABC' back to 'db_owner'.

alter authorization on schema::db_owner to db_owner

After that the user ABC can be dropped.
Drop the schema as drop schema db_owner is ok but default it was there so I just keep what it was.
Go to Top of Page

NeilG
Aged Yak Warrior

530 Posts

Posted - 2012-10-12 : 03:53:56
Alter ownership and delete user would be my advice
Go to Top of Page
   

- Advertisement -