Getting Number of Logged On Users to Server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tim Morrison

    Getting Number of Logged On Users to Server

    SQL Server 2000 - MSDE 2000

    Is there a way to get the number of current users logged into a SQL 2000 Server (also MSDE)? Cant be distinct users as most users are logged into the database using the same login.

    --
    Tim Morrison

    --------------------------------------------------------------------------------

    Vehicle Web Studio - The easiest way to create and maintain your vehicle related website.

  • Erland Sommarskog

    #2
    Re: Getting Number of Logged On Users to Server

    Tim Morrison (sales@kjmsoftw are.com) writes:[color=blue]
    > SQL Server 2000 - MSDE 2000
    >
    > Is there a way to get the number of current users logged into a SQL 2000
    > Server (also MSDE)? Cant be distinct users as most users are logged into
    > the database using the same login.[/color]

    select count(*) from master..sysproc esses where spid > 50 will give you
    a rough number. This will include logins from SQL Agent. Note that the
    same user can be using multiple connections from the same application,
    and thus be counted more than once.



    --
    Erland Sommarskog, SQL Server MVP, sommar@algonet. se

    Books Online for SQL Server SP3 at
    Accelerate your AI application's time to market by harnessing the power of your own data and the built-in AI capabilities of SQL Server 2025, the enterprise database with best-in-class security, performance and availability.

    Comment

    • Tim Morrison

      #3
      Re: Getting Number of Logged On Users to Server

      hmmm..... thanks for the info. Im surprised there isnt a more definate way
      to get this information from SQL.

      Tim Morrison

      "Erland Sommarskog" <sommar@algonet .se> wrote in message
      news:Xns9445430 E3C3FYazorman@1 27.0.0.1...[color=blue]
      > Tim Morrison (sales@kjmsoftw are.com) writes:[color=green]
      > > SQL Server 2000 - MSDE 2000
      > >
      > > Is there a way to get the number of current users logged into a SQL 2000
      > > Server (also MSDE)? Cant be distinct users as most users are logged into
      > > the database using the same login.[/color]
      >
      > select count(*) from master..sysproc esses where spid > 50 will give you
      > a rough number. This will include logins from SQL Agent. Note that the
      > same user can be using multiple connections from the same application,
      > and thus be counted more than once.
      >
      >
      >
      > --
      > Erland Sommarskog, SQL Server MVP, sommar@algonet. se
      >
      > Books Online for SQL Server SP3 at
      > http://www.microsoft.com/sql/techinf...2000/books.asp[/color]


      Comment

      • Tim Morrison

        #4
        Re: Getting Number of Logged On Users to Server

        I see that one of the fields is "program_na me" in the sysprocesses table. I
        have Crystal Reportsrunning so that is one of the processes. How do I get my
        app to report itself as one of those processes like crystal?

        Then I can do a 'SELECT count(*) FROM sysprocesses WHERE program_name =
        'MyApp'.


        TIA

        Tim Morrison
        "Erland Sommarskog" <sommar@algonet .se> wrote in message
        news:Xns9445430 E3C3FYazorman@1 27.0.0.1...[color=blue]
        > Tim Morrison (sales@kjmsoftw are.com) writes:[color=green]
        > > SQL Server 2000 - MSDE 2000
        > >
        > > Is there a way to get the number of current users logged into a SQL 2000
        > > Server (also MSDE)? Cant be distinct users as most users are logged into
        > > the database using the same login.[/color]
        >
        > select count(*) from master..sysproc esses where spid > 50 will give you
        > a rough number. This will include logins from SQL Agent. Note that the
        > same user can be using multiple connections from the same application,
        > and thus be counted more than once.
        >
        >
        >
        > --
        > Erland Sommarskog, SQL Server MVP, sommar@algonet. se
        >
        > Books Online for SQL Server SP3 at
        > http://www.microsoft.com/sql/techinf...2000/books.asp[/color]


        Comment

        • Carlos Fandango

          #5
          Re: Getting Number of Logged On Users to Server

          You can specify it in the connection string, something like "Applicatio n
          Name = etc" Its documented in the ADO/OLE DB/ODBC connection strings
          documentation.


          "Tim Morrison" <sales@kjmsoftw are.com> wrote in message
          news:CxQyb.3817 93$HS4.3135751@ attbi_s01...[color=blue]
          > I see that one of the fields is "program_na me" in the sysprocesses table.[/color]
          I[color=blue]
          > have Crystal Reportsrunning so that is one of the processes. How do I get[/color]
          my[color=blue]
          > app to report itself as one of those processes like crystal?
          >
          > Then I can do a 'SELECT count(*) FROM sysprocesses WHERE program_name =
          > 'MyApp'.
          >
          >
          > TIA
          >
          > Tim Morrison
          > "Erland Sommarskog" <sommar@algonet .se> wrote in message
          > news:Xns9445430 E3C3FYazorman@1 27.0.0.1...[color=green]
          > > Tim Morrison (sales@kjmsoftw are.com) writes:[color=darkred]
          > > > SQL Server 2000 - MSDE 2000
          > > >
          > > > Is there a way to get the number of current users logged into a SQL[/color][/color][/color]
          2000[color=blue][color=green][color=darkred]
          > > > Server (also MSDE)? Cant be distinct users as most users are logged[/color][/color][/color]
          into[color=blue][color=green][color=darkred]
          > > > the database using the same login.[/color]
          > >
          > > select count(*) from master..sysproc esses where spid > 50 will give you
          > > a rough number. This will include logins from SQL Agent. Note that the
          > > same user can be using multiple connections from the same application,
          > > and thus be counted more than once.
          > >
          > >
          > >
          > > --
          > > Erland Sommarskog, SQL Server MVP, sommar@algonet. se
          > >
          > > Books Online for SQL Server SP3 at
          > > http://www.microsoft.com/sql/techinf...2000/books.asp[/color]
          >
          >[/color]


          Comment

          Working...