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 2000 Forums
 SQL Server Administration (2000)
 Delete user from Database Roles

Author  Topic 

sqlpal2007
Posting Yak Master

200 Posts

Posted - 2007-10-08 : 13:57:07
Hi All,

I need to delete the user and login of a terminated employee from all the databases from the productrion server. I foudn the stored proc on internet to delete the user and login but eventhough the login was deleted the user was still showing in the database role.
I do not understand how the login got deleted without deleting it's reference from the database roles?

Can anyone tell me how to delete the user from the database roles? I do not want to perform the task by going in each database and then roles and then remove the user -:(

Your help will be greatly appreciated.

Thanks,
-P

Zoroaster
Aged Yak Warrior

702 Posts

Posted - 2007-10-08 : 14:24:20
You have to remove the Database user, that will remove the user from the roles.

USE <databasename>
DROP USER <username>
GO




Future guru in the making.
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-10-08 : 22:15:08
Sql login is different from db user, even they have same name in most case. Db user can map to different sql login, that's why db user is still there after you deleting sql login it mapped to.
Go to Top of Page

sqlpal2007
Posting Yak Master

200 Posts

Posted - 2007-10-09 : 08:40:44
Thanks for the suggestions and clarifications. The user is gone from the role once I dropped the user.

Thanks,
-P
Go to Top of Page
   

- Advertisement -