SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 delete a user with schema
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

allan8964
Posting Yak Master

249 Posts

Posted - 10/03/2012 :  11:58:51  Show Profile  Reply with Quote
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

India
52317 Posts

Posted - 10/03/2012 :  12:12:24  Show Profile  Reply with Quote
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 - 10/03/2012 :  12:35:38  Show Profile  Reply with Quote
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

India
52317 Posts

Posted - 10/03/2012 :  12:47:12  Show Profile  Reply with Quote
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 - 10/03/2012 :  16:01:25  Show Profile  Reply with Quote
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.

Edited by - allan8964 on 10/03/2012 16:02:10
Go to Top of Page

NeilG
Aged Yak Warrior

United Kingdom
530 Posts

Posted - 10/12/2012 :  03:53:56  Show Profile  Reply with Quote
Alter ownership and delete user would be my advice
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.12 seconds. Powered By: Snitz Forums 2000