Thursday, March 22, 2012

The database principal owns a schema in the database, and cannot be dropped

While restoring a database backup file in my hosting I was prompted with some error message regarding existing user in the database. So I decided to delete those users. But while trying to delete the users from my local sql sever management studio, error occurred.
The database principal owns a schema in the database, and cannot be dropped.
I tried out browsing the property of the user and removing the assigned scheme from the lists. It was somehow unsucessful. So I decided to go search for the solution and stumbled at doing it the most powerful way - through command.
Here goes the solution - Revoke the database schema assigned to the user and assign it back to the default db object.
ALTER AUTHORIZATION ON SCHEMA :: my_user_name to db_owner
 If you want to assign the schema  to another user, here is how you accomplish it.
 ALTER AUTHORIZATION ON SCHEMA :: my_schema_name to my_user_name
Cheers!
kick it on DotNetKicks.com

0 comments:

Post a Comment

Hope you liked this post. You can leave your message or you can put your valuable suggestions on this post here. Thanks for the sharing and cooperation!

Popular Posts

Recent Articles