Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2014
    Posts
    42
    Provided Answers: 1

    Unanswered: query to get the count of users and logins

    Hi ,

    I need a query for getting the list of users in a server(1 application) and list of logins as well .

    use <userdefined database>
    go
    select count(*) from sysusers
    go
    select count(*) from syslogins
    go

    is the above statements are right or wrong ,if not , please guide me in getting the count of users and logins from the current server or db.

  2. #2
    Join Date
    Jan 2012
    Location
    Lisbon
    Posts
    115
    Provided Answers: 1
    Hi,

    If you want the list of Logins on the server is one thing, if you want list of users with login name by DB is another.

    I will assume is the second, for each DB ( you can make a cursor to go through the exisiting DBs) run:

    select l.suid as "SUID", u.uid as "UID", u.name as "User Name", l.fullname as "Full Name"
    from sysusers u, master..syslogins l
    where u.suid = l.suid

    --or
    --where l.name = u.name
    Last edited by Catarrunas; 03-05-14 at 07:12.

  3. #3
    Join Date
    Feb 2014
    Posts
    42
    Provided Answers: 1

    db logins

    I need to retreive the users/logins w.r.t the database

  4. #4
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    There is no login per database; logins is per Sybase server instance and users is per database i.e. you'll need one select from syslogins in the master DB and multiple selects from sysusers depending on the number of databases.

  5. #5
    Join Date
    Feb 2014
    Posts
    42
    Provided Answers: 1
    Thanks for that , now i am pretty clear and got the desired output

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •