SQL Server Performance

all users

Discussion in 'SQL Server 2005 T-SQL Performance Tuning' started by PatDeV, Jun 12, 2007.

  1. PatDeV New Member

    Hi all,

    I amnew to this, need to find all database users on the server!!

    thanks

    Thanks!!
  2. satya Moderator

    SP_HELPUSER & SP_HELPLOGINS will give you such information.
    Refer to the books online too for more information on returning such information.

    Satya SKJ
    Microsoft SQL Server MVP
    Writer, Contributing Editor & Moderator
    http://www.SQL-Server-Performance.Com
    This posting is provided AS IS with no rights for the sake of knowledge sharing. Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it.
  3. Raulie New Member

    To build a query of all your users on the server you can use

    SELECT
    p.name,
    p.type_desc,
    p.is_disabled,
    p.default_database_name,
    l.hasaccess,
    l.denylogin

    FROM

    sys.server_principals p LEFT JOIN sys.syslogins l

    ON ( l.name = p.name ) WHERE p.type IN ( 'S', 'G', 'U' )

    Also look up Catalog Views in books online


    Raulie



Share This Page