Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8448605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:28:24+00:00 2026-06-10T10:28:24+00:00

I am doing a project called Attendance Management System The company has its own

  • 0

I am doing a project called “Attendance Management System”

The company has its own biometric finger scanner who checks for employee’s attendance and stored in on a database table.

The table consist of 4 fields (ID autonumber, EmployeeNo, CheckTime and CheckType)

The Timekeeping system store all the employee’s logs and attendance but it doesn’t specify whether the checktype is “I” or “O”. As you can see the image below, everytime the employee log in, the system store it to database automatically but it stored as “I”, and when the same employee log in again it will store as “I” again.

enter image description here

My client want it to be automated as possible. He wants to changed the checktype to “O” once the employee login again.

For example:

I am an employee. I am going to log in at today 8am, then it will store to database as

today 8AM with checktype “I”.. since I am not aware that I have logged in already, I loged in again for the second time at 8:04 AM.. the system stores it as “I” again the same as if I am going to logout at 5PM, the system also record it as “I”..

I would like this to update the database automatically.Without any parameters provided by the user. I want it to be in a stored procedure to automate the process.

It should be restricted within the same employee:
Example:

Employee1 logged at today 8am.. (checktype “I”)
Employee1 logged again at today 11am… (checktype “O”)
employee1 logged again at today 12pm.. (checktype “I”)
employee1 logged again at today 4pm (checktype “O”)

Criterias should be restricted within employeeno, checktime only.. and would like to update checktype also based on given datas.

The old system is not capable storing logged ins as “O” it was purely “I”..

How to do this? I need your inputs and help badly! Please?

I have created a stored procedure but do not know where I can start it and I dont have the idea to finish the procedure and make it work..

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE AUTOMATIC_OVERRIDE
    @ID INT,
    @EMPLOYEENO NVARCHAR(20),
    @CHECKTIME DATETIME,
    @CHECKTYPE NVARCHAR(1)

AS
    SET NOCOUNT ON;
    WHILE @ID = (SELECT ID FROM CHECKTIME)

        SELECT ID,EMPLOYEENO,CHECKTIME,CHECKTYPE
          FROM CHECKTIME
         GROUP BY ID,EMPLOYEENO,CHECKTIME,CHECKTYPE
         ORDER BY CHECKTIME
GO

Please help me to solve this problem. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T10:28:25+00:00Added an answer on June 10, 2026 at 10:28 am

    EDIT:

    The solution into the PRC:

    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    
    CREATE PROCEDURE AutomaticOverrideByID
        @ID INT,
        @EMPLOYEENO NVARCHAR(20)
    
    AS
    
        UPDATE CHECKTIME
        SET CHECKTYPE = CASE WHEN (SELECT
        COUNT(ID) AS CountOfLogin
        FROM CHECKTIME
        WHERE CHECKTIME.EMPLOYEENO = @EMPLOYEENO 
        AND CHECKTIME.CheckTime < C.CheckTime) % 2 = 1 THEN 'O' ELSE CHECKTYPE END
        FROM CHECKTIME C
        WHERE C.ID = @ID
    
    GO
    

    And here is an UPDATE to the existing dataset as Dhenn asked:

    UPDATE CHECKTIME
    SET CHECKTYPE = CASE WHEN (SELECT
    COUNT(ID) AS CountOfLogin
    FROM CHECKTIME
    WHERE CHECKTIME.EMPLOYEENO = C.EMPLOYEENO 
    AND CHECKTIME.CheckTime < C.CheckTime) % 2 = 1 THEN 'O' ELSE CHECKTYPE END
    FROM CHECKTIME C
    

    SQL Fiddle attached.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing Oracle database project which called Theatre booking system. I am trying
I am doing a project called user initiated real time object tracking system .
Im doing a project in which im including an already done program. It has
I am currently doing a project called eye controlled cursor using MATLAB. I have
I'm a student doing an extra-grade project, and my prof has asked me to
I've been doing project Euler for a few days, and I have to admit
I'm doing project on object detection using javacv in that I went through couple
I am doing project euler question 33 and have divised a refactor to solve
I am doing project in cakephp . I want to write below query in
im doing research project for a the game Text twist,the text will automatically search

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.