SQL Server Performance

Set default time in SQL Server and Store Procedure

Discussion in 'SQL Server 2005 T-SQL Performance Tuning' started by ndindi22, Dec 10, 2007.

  1. ndindi22 New Member

    [?]Hi guys I'm writing a Stored Procedure, on SQL Server 2005. I need to set a default time for the clock system, The clock in/out system works like this: When you clock in = 0, Clock Out = 1. So other employees they forget to clock out, we want to set a default time that when the employee didn't clock out then clock out time is 4:00PM. I've been struggling I don't know how to tackle it. Please help. Ndi
  2. ranjitjain New Member

    You need to update all previous record apart from current day where records are still showing clock-in i.e. employees forgot to check-out. This way simply update the check-out time to that day's 4:00 PM. is this what you are after?
    What about a situation where employee check-in at 5:00 PM and forgets to check-out.
  3. ndindi22 New Member

    Our working hours are 8:00 AM to 4:00PM, so if an employee has logged in for that day, and forget to log out the we take the default time which is 4:00 even if he worked overtime. So my system needs to check if from the previous day did the employee logged out if not then set the default time, but if logged out the use the time of logged out.
  4. ranjitjain New Member

    Hi,
    If your working hours ends at 4:00 then I don't see any other issue here, create a script to retrive all the records which are historical and where logout time is not recorded or bit is false and update them with 4:00PM, and then if required you can scedule the script to run overnight to automate things, so what's the issue you are getting now.

Share This Page