SQL Naive query

  • Hello I am new to this forum Is there any way to find out what are the current groups and logins in the sql server and what are the rights to them, through query ?

  • Start with:

    select *

    from sys.syslogins;

    That will give you a list of the logins.

    If you look that up in Books Online or on MSDN, it will have links to related items, which will give you the other data you need.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Insert obligatory 'syslogins is deprecated, should not be used for new development, included only for backward compat, will be removed in a future version'

    Query sys.server_principals for the logins

    SELECT * FROM sys.server_principals AS sp WHERE type IN ('S','U','G')

    That will get you all the SQL and windows logins on the server.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Thanks Adiga

    Thanks Gila, That's exactly what I was looking for.

  • Adiga?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Oops my mistake, Its for GSquared....

Viewing 6 posts - 1 through 5 (of 5 total)

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