Tuesday, March 27, 2012

Cannot drop user. Can anyone help?

When trying to drop a user I get ' The database principle owns a schema in the database and cannot be dropped'

How Can I get around this? How can I tell which schema the user owns. It is not listed in the properties of the user.

How can I view a list of schema's and who they are owned by and how can I change ownership of schema's?|||

Hi,

Which Version of Sql you are using? I assume that you are using SQL Server 2005 only. First you need to drop the schema to which the user is binded and then drop the user.

1.Open SSMS, Select your data base.

2. Select "Security" folder and expand it.

3. Select "User" folder and expand it.

4. Select and right click the user to be dropped.

5. Select "Properties" command will open "Database User" dialog box.

6. You can view the schemas which are binded to that user in the "Owned Schemas" section.

7. After determining the schema name, just cancel that dialog window.

8. Expand "Schemas" folder and select the schema that you have determined in step-4.

9. Delete/Drop that schema and then drop the user.

Hope this will help you.

Thanks & Regards,

Kiran.Y

|||

in Security->Users->Right click->Properties-> I have "Schema owned by this user" and I have a check box marked on appropriate schema.

you can run too:

use yourDB

go

select schema_name,schema_owner

from information_schema.schemata

|||

For changing ownership of schema see ALTER AUTHORIZATION command in Books Online

|||

i have blogged this with example. See this

http://madhuottapalam.blogspot.com/search?q=Drop+Database+User+who+Owns+Schema

Madhu

No comments:

Post a Comment