Has anyone compared two datetimes to see if they are in the same time frame?
Our contract with hosting services allows us 10 concurrent users.
Nobody users were complaining, but I had a hunch we might be close to that limit.
I wrote some SQL to find count the max users per day aggregated per day over the last 6 months:
from the table TA_AUDIT_LOGON_INTERNAL, which i'm hoping was the right table for a login history table.
the table looks like this:
SQL:
SELECT CAST(logon_dt AS DATE) AS ActivityDate, COUNT(DISTINCT user_id) AS UniqueUserCount FROM TA_AUDIT_LOGON_INTERNAL WHERE logon_dt >= DATEADD(MONTH, -6, GETDATE()) AND status = 0 GROUP BY CAST(logon_dt AS DATE) ORDER BY ActivityDate; /* TA_AUDIT_LOGIN_INTERNAL status dictionary 0 = successful login 1 = invalid tessitura login 2 = login is already locked 3 = SQL Server login failed 4 = too many invalid attempts so locking login 5 = invalid password entered 6 = no app access per group security settings */
result:
graphed it out in excel:
so i can see we have max 20 users per day, but on average12ish per day. So we need probably need to increase our concurrent user limit.
This was a great, but i'm curious to actually count concurrent users (not just total users) by comparing logon_dt to logout_dt aggregated per day?
I'm thinking of a third column and the logic would be something like "If count of concurrent users >10 then "1" and then have some subquery to compare time frames per day and count how many"
just confused on how to do that!Any help is appreciated!
Have you looked at the Concurrent Users Analysis report in the Miscellaneous folder? It can give by Date or By Date and hour...
I didn't know that report existed!It seems like i've manually tried to recreate that haha, thanks for the tip Mary
what's really cool is now you can look at the stored procedure behind that report and see how close you were with your own code! :-) I tend to pick apart other reports as a learning thing- super helpful.
Doesn't concurrent mean at any one time (not on any given date)? I'm guessing that the report factors in both the logon_dt and logout_dt fields to calculate the number of concurrent users.