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
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Drop all users in a database

Author  Topic 

whizsql
Starting Member

17 Posts

Posted - 2008-12-12 : 14:22:23
Unable to drop all users...I need help to write a script that iterates through all users in a database and drop them.

When I tried to delete a user from SSMS manually, it didnt permit for many users as it says, user owns schemas...How can I drop all users with a cascade option...that is, it should drop all dependant objects too...

Please help.

Thanks !

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-12-12 : 16:24:55
You need to remove owned schema from users before you can drop them all.
Go to Top of Page

whizsql
Starting Member

17 Posts

Posted - 2008-12-12 : 16:26:46
how?

is there any way I can tranfer ownership of all schemas in a database to dbo ?

Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-12-12 : 16:58:17
You need to use 'ALTER AUTHORIZATION on Schema::schema to dbo' for it.
Go to Top of Page
   

- Advertisement -