Re: User Termination



Hello,

I prefer to do this manually; basically you need to transfer the ownership
using sp_changeobjectowner if you have this user owns any objects.

1. Execute sp_helplogins <Login_Name> to get all the database user mapping
in different
2. Go to each database and drop the user sp_dropUser <username>
3. Finally drop the login using sp_droplogin <loginname>

Thanks
Hari

"Agoo" <agoo@xxxxxx> wrote in message
news:eHG3SFiHHHA.4688@xxxxxxxxxxxxxxxxxxxxxxx
Hi All,

I'm a newby to SQL and I would like to create a SQL stored proc to drop a
given user from all databases, and the drop the login.

So if any given server has 10 or 12 databases, I was hoping the proc would
loop through whatever the databases are : Select name from
master..sysdatabases and drop the user if it exists. Then finally drop
the login from the server.

Anybody got something like this already? Much appreciated.
-Aaron
Agoo@xxxxxx





.



Relevant Pages

  • Re: Remove/Add BUILTINAdministrators 2000 sp4
    ... I have seen a windows group referred to as a LOGIN for sql server in the ... the databases, and so it makes it dbo on all databases again. ...
    (microsoft.public.sqlserver.security)
  • Logins
    ... We have a SQL Server login which is used by two applications, ... separate databases on the server. ... information for the databases for which the login has been added as a user. ...
    (microsoft.public.sqlserver.security)
  • Re: Remove/Add BUILTINAdministrators 2000 sp4
    ... Server, it some how knows that on this server, it use to be the dbo in all ... the databases, and so it makes it dbo on all databases again. ... via this LOGIN ...
    (microsoft.public.sqlserver.security)
  • Re: Remove/Add BUILTINAdministrators 2000 sp4
    ... detected that this login has permissions....etc this login ... be mapped to dbo. ... sysusers in the user databases and syslogins in master. ... I have seen a windows group referred to as a LOGIN for sql server in the ...
    (microsoft.public.sqlserver.security)
  • Re: Remove/Add BUILTINAdministrators 2000 sp4
    ... any of the databases. ... exist anywhere in sql server either. ... detected that this login has permissions....etc this login ... be mapped to dbo. ...
    (microsoft.public.sqlserver.security)