From: Eirikh on
Milosz Skalecki and others,

I would rather go:

SELECT COUNT(*) AS SessionCount
FROM [ASPStateTempSessions]
WHERE ([Expires] > GETDATE())

GETDATE() instead of a variable that's not really needed (and only
declared?) and I changed the < to > to actually get all sessions that expires
in the future, and not the ones that have already expired...


"Milosz Skalecki" wrote:

> Joe,
>
> Performance counters are only valid for In-Process session state management.
> To count active sessions in SQLServer mode you need to create a stored
> procedure in the tempdb database that returns the counter:
>
> DECLARE @Now DATETIME
>
> SELECT COUNT(*) AS SessionCount
> FROM ASPStateTempSessions
> WHERE (Expires < @Now)
>
>
> hope this helps
> --
> Milosz Skalecki
> MCP, MCAD
>
>
> "JoeSep" wrote:
>
> > Hello,
> > I know that when the SessionState is set to SQL Server (ASP.NET 1.1) these
> > counters in PerfMon are not valued:
> > - Sessions Abandoned
> > - Sessions Active
> > - Sessions Timed Out
> > - Sessions Total
> > Is there another way to get these counters (especially "Sessions Active")
> > when the SessionState is set to SQL Server?
> > Thanks in advance!
> > Joe
> >
> > --
From: Eirikh on
I actually ended up with this:

SELECT COUNT(*) AS SessionCount FROM ASPStateTempSessions WHERE
DATEADD(mi,15,LockDateLocal) > CURRENT_TIMESTAMP

Users active in the last 15 minutes ...

"Eirikh" wrote:

> Milosz Skalecki and others,
>
> I would rather go:
>
> SELECT COUNT(*) AS SessionCount
> FROM [ASPStateTempSessions]
> WHERE ([Expires] > GETDATE())
>
> GETDATE() instead of a variable that's not really needed (and only
> declared?) and I changed the < to > to actually get all sessions that expires
> in the future, and not the ones that have already expired...
>
>
> "Milosz Skalecki" wrote:
>
> > Joe,
> >
> > Performance counters are only valid for In-Process session state management.
> > To count active sessions in SQLServer mode you need to create a stored
> > procedure in the tempdb database that returns the counter:
> >
> > DECLARE @Now DATETIME
> >
> > SELECT COUNT(*) AS SessionCount
> > FROM ASPStateTempSessions
> > WHERE (Expires < @Now)
> >
> >
> > hope this helps
> > --
> > Milosz Skalecki
> > MCP, MCAD
> >
> >
> > "JoeSep" wrote:
> >
> > > Hello,
> > > I know that when the SessionState is set to SQL Server (ASP.NET 1.1) these
> > > counters in PerfMon are not valued:
> > > - Sessions Abandoned
> > > - Sessions Active
> > > - Sessions Timed Out
> > > - Sessions Total
> > > Is there another way to get these counters (especially "Sessions Active")
> > > when the SessionState is set to SQL Server?
> > > Thanks in advance!
> > > Joe
> > >
> > > --