list the no of users

  • what is the query to find the no of users ina database?

  • SELECT count(1) FROM sysusers

    Use only as applicable.

    -Forum Etiquette: How to post Performance Problems[/url]

    -Forum Etiquette: How to post data/code to get the best help [/url]

  • Vishal Singh (10/7/2009)


    SELECT count(1) FROM sysusers

    Use only as applicable.

    that isnt right, that count includes database roles as well. if you want to include public, dbo, guest and INFORMATION_SCHEMA as well.

    you can say

    select count(1) from sysusers where uid < 16384

    or to do it in the old fashioned way

    sp_helpuser

    will give you the users in the current database.

    --------------------------------------------------------------------------------------
    [highlight]Recommended Articles on How to help us help you and[/highlight]
    [highlight]solve commonly asked questions[/highlight]

    Forum Etiquette: How to post data/code on a forum to get the best help by Jeff Moden[/url]
    Managing Transaction Logs by Gail Shaw[/url]
    How to post Performance problems by Gail Shaw[/url]
    Help, my database is corrupt. Now what? by Gail Shaw[/url]

  • Aaah..I thought that I have posted it with Where clause (where uid < 16384)..Thanks for the correction.

    -Forum Etiquette: How to post Performance Problems[/url]

    -Forum Etiquette: How to post data/code to get the best help [/url]

  • Are you talking about no of user currently connected on the server?

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

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