Delete of Login

  • Hi All

    I am Novice user for SQL2005 in administration side, n trying to understand.

    I got to delete a login.The method I follow is

    1) SELECT U.NAME, S.NAME

    FROM SYSUSERS U INNER JOIN MASTER.DBO.SYSLOGINS S

    ON U.SID = S.SID

    2) Drop the User - "exec sp_dropuser N'Test'"

    3) Drop the Login - "exec sp_droplogin N'Test1'"

    Now My question is I know the Login name to delete, I run this 3 script in each database separately and do this, Is there a way where I can run from "master" database and do this without running in all DB separately.

    Thanks for ur time in advance.

  • The easiesrt method to do is use SSMS and then delete the login from the security folder.

    Cheers,
    Sugeshkumar Rajendran
    SQL Server MVP
    http://sugeshkr.blogspot.com

  • I suggest removing rights to any databases that this login may have first prior to deleting the login. As suggested this can all be done in SSMS. Right-click the login, select Properties\User Mapping then uncheck any databases that may be checked. Save and then delete the login by right-clicking and selecting Delete.

    - Tim Ford, SQL Server MVPhttp://www.sqlcruise.comhttp://www.thesqlagentman.com http://www.linkedin.com/in/timothyford

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply