drop sql login and related database users altogether

From: Nitin Rana (Nitin_Rana_at_ibi.com)
Date: 07/12/04


Date: Mon, 12 Jul 2004 15:47:53 -0700

Hi,

This is what you need to do.

Dump the result set of this query in a temp table or set a
cursor for read only.
and then loop thru it. Of course you wanna make sure that
login name is not SA.

select name , suser_sname(sid) from
master.dbo.sysdatabases
WHERE suser_sname(sid) = @InputLogin

-Nitin

>-----Original Message-----
>Hi, I¡¯m wondering if there is procedure which is based
on SQL login to
>return all database names for which user is owner.
>then drop user from each database, and finally drop sql
login.
>
>
>
>
>
>
>.
>



Relevant Pages

  • Re: MS JET database engine error: workgroup information file is missing or opened exclusively by ano
    ... What database are you using? ... > using Microsoft JET database engine, but it gives me an error saying ... > This error only exists if i use an MS SQL login with a password but it ... > fine with a login without a password. ...
    (microsoft.public.sqlserver.odbc)
  • Re: SQL Connection String using Domain Account
    ... The DBA has given me a Domain user account with rights to the ... | to get a connection to the database. ... or Login failed for userID. ... You can map a domain account to a SQL login, see CREATE LOGIN in SQL books ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Crystal report problem
    ... > rpt.SetDatabaseLogin(UID, PWD, SERVER, DATABASE) ... > where UID = sql login ... >> No error, it just comes up with a dialog box to login to the server, the ...
    (microsoft.public.dotnet.languages.vb)
  • Security - limit to the publication
    ... I'm trying to setup replication over the internet using FTP. ... I have created a SQL Login to SQL Server to use for replication (unless I'm ... database and view all the data. ...
    (microsoft.public.sqlserver.replication)
  • Re: PDO: Switch database user without reopening connection
    ... At the bare minimum there will be a login user who only has ... modifications to the database as well (editors get update permission, ... As database connections are expensive to ... a certain visitor in the Session, and use that value to start the right ...
    (comp.lang.php)