Who all are the users

  • How can we find who all are the users connected in our database??

    Plz give me the procedure and navigation.....

  • sp_who2 is the command you want to run and it should provide all the information you need.

    David

    @SQLTentmaker

    “He is no fool who gives what he cannot keep to gain that which he cannot lose” - Jim Elliot

  • Thanq david

    It shows all the spid inf

    But i need only USERS

  • Hi,

    You may try querying "sysprocesses" table (Master database) and apply filter on the rquired column.

    [font="Verdana"]Renuka__[/font]

  • select Login_name from sys.sysprocesses

    --To find hostwise connection

    select hostname,count(spid) as Total_Connection,sum(isnull(memusage,0)) as MemUsage from sys.sysprocesses

    group by hostname

    ----------

    --To find Database wise connection

    select db_name(dbid) as DatabaseName,count(spid) as Total_Connection,sum(isnull(memusage,0)) as MemUsage from sys.sysprocesses

    group by db_name(dbid)

    _____________________________________________________________________________________________________________
    Paresh Prajapati
    ➡ +919924626601
    http://paresh-sqldba.blogspot.com/[/url]
    LinkedIn | Tweet Me | FaceBook | Brijj

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

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