Skip to content

Instantly share code, notes, and snippets.

@othtim
Created July 5, 2013 20:17
Show Gist options
  • Select an option

  • Save othtim/5936971 to your computer and use it in GitHub Desktop.

Select an option

Save othtim/5936971 to your computer and use it in GitHub Desktop.
check users logged in in SchoolLogic database
--assumes default IIS/ASP.net timeout of 20 minutes
select
row_number() over (partition by cusername order by cusername) as [count]
, cUserName, tLogin, cApplication, cmachinename
from log
where DATEDIFF(MINUTE, tlogin, CURRENT_TIMESTAMP) < 20
and lSuccess = 1
and tLogout = ''
order by tLogin desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment