Delete login from all databases

  • How can i delete login and schema from all the databases including server.

    I orphan logins by using sp_validatelogins and want to delte them.

  • After you write the script to delete from each database the schema/users you can use the Microsoft shipped function for each database to do the job...

    Read up at http://www.dbazine.com/sql/sql-articles/larsen5/.

    Thanks.

    [font="Arial"]---

    Mohit K. Gupta, MCITP: Database Administrator (2005), My Blog, Twitter: @SQLCAN[/url].
    Microsoft FTE - SQL Server PFE

    * Some time its the search that counts, not the finding...
    * I didn't think so, but if I was wrong, I was wrong. I'd rather do something, and make a mistake than be frightened and be doing nothing. :smooooth:[/font]

    How to ask for help .. Read Best Practices here[/url].

  • There is an undocumented sp: sp_msforeachdb. By using this you can run the script for all databases at once.

    Eg:

    EXEC sp_Msforeachdb "DBCC checkdb ('?')"

    http://www.sqlservercentral.com/articles/Advanced+Querying/sp_msforeachdb/182/

  • Just mention for what purpose.and why?

    [font="Comic Sans MS"]+++BLADE+++[/font]:cool:

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

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