Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DECLARE @EmpTable AS TABLE (EmpId Int, EmpName Nvarchar(255))
- INSERT INTO @EmpTable (EmpId, EmpName) VALUES (001, 'Paul')
- INSERT INTO @EmpTable (EmpId, EmpName) VALUES (002, 'Juan')
- INSERT INTO @EmpTable (EmpId, EmpName) VALUES (003, 'Elise')
- INSERT INTO @EmpTable (EmpId, EmpName) VALUES (004, 'John')
- INSERT INTO @EmpTable (EmpId, EmpName) VALUES (005, 'Smith')
- DECLARE @Duty AS TABLE (ID Int, StaffId Int, Shedule Nvarchar(255), BreakTime Nvarchar(255), DutyDate DateTime, Status Nvarchar(50) )
- INSERT INTO @Duty (ID, StaffId, Shedule, BreakTime, DutyDate, Status) VALUES (1, 001, '11:00PM - 8:00AM', '02:00AM - 03:00AM', '2015-07-25', 'Sick Leave')
- INSERT INTO @Duty (ID, StaffId, Shedule, BreakTime, DutyDate) VALUES (2, 002, '11:00PM - 8:00AM', '02:00AM - 03:00AM', '2015-07-25')
- INSERT INTO @Duty (ID, StaffId, Shedule, BreakTime, DutyDate) VALUES (3, 003, '04:00PM - 11:00PM', '08:00PM - 09:00PM', '2015-07-26')
- INSERT INTO @Duty (ID, StaffId, Shedule, BreakTime, DutyDate) VALUES (4, 004, '08:00AM - 4:00PM', '12:00PM - 01:00PM', '2015-07-25')
- INSERT INTO @Duty (ID, StaffId, Shedule, BreakTime, DutyDate) VALUES (5, 005, '04:00PM - 11:00PM', '08:00PM - 09:00PM', '2015-07-26')
- DECLARE @Attendance AS TABLE (ID Int, StaffNo Int, DeviceId Int, Clock DateTime)
- INSERT INTO @Attendance (ID, StaffNo, DeviceId, Clock) VALUES (1, 004, 0, '2015-07-25 08:01:00AM')
- INSERT INTO @Attendance (ID, StaffNo, DeviceId, Clock) VALUES (2, 004, 1, '2015-07-25 08:01:00AM')
- INSERT INTO @Attendance (ID, StaffNo, DeviceId, Clock) VALUES (3, 004, 0, '2015-07-25 08:01:00AM')
- INSERT INTO @Attendance (ID, StaffNo, DeviceId, Clock) VALUES (4, 004, 1, '2015-07-25 08:01:00AM')
- INSERT INTO @Attendance (ID, StaffNo, DeviceId, Clock) VALUES (5, 002, 0, '2015-07-25 08:01:00AM')
- INSERT INTO @Attendance (ID, StaffNo, DeviceId, Clock) VALUES (6, 002, 1, '2015-07-25 08:01:00AM')
- INSERT INTO @Attendance (ID, StaffNo, DeviceId, Clock) VALUES (7, 002, 0, '2015-07-25 08:01:00AM')
- INSERT INTO @Attendance (ID, StaffNo, DeviceId, Clock) VALUES (8, 002, 1, '2015-07-25 08:01:00AM')
- INSERT INTO @Attendance (ID, StaffNo, DeviceId, Clock) VALUES (9, 003, 0, '2015-07-25 08:01:00AM')
- INSERT INTO @Attendance (ID, StaffNo, DeviceId, Clock) VALUES (10, 003, 1, '2015-07-25 08:01:00AM')
- INSERT INTO @Attendance (ID, StaffNo, DeviceId, Clock) VALUES (11, 003, 0, '2015-07-25 08:01:00AM')
- INSERT INTO @Attendance (ID, StaffNo, DeviceId, Clock) VALUES (12, 003, 1, '2015-07-25 08:01:00AM')
Add Comment
Please, Sign In to add comment