title: Timed triggers for Sql Server
body: <p>In my project, I have a SQL table which keeps track of logged users. If a user is logged in, a flag field is set to <code>true</code> and if the user logs out the same flag is set to <code>false</code>.</p>
  
  <p>The application (C#) is responsible to set the flag on or off and everything works fine when the user logs in and logs out before closing the application.</p>
  
  <p>However, when a user is logged in and in case of a power outage for example —assuming power went off on the client side, but not on the server side— the users connection will drop before the application sets the <code>logged</code> flag to <code>false</code>. For compensation of this uncertainty case, I want the SQL server to check periodically (say, once every 5 minute), whether  the client is still there/logged/active or not.</p>
  
  <p>How do I create a trigger for this case on the server side?</p>