ALTER PROCEDURE [dbo].[USP_HR_SelectLast_Attendance_Master]
AS
BEGIN
DECLARE @EmployeeId varchar(50),
@CheckIn datetime,
@CheckOut datetime
SELECT @EmployeeId = EmployeeId,@CheckIn=CheckIn,@CheckOut=CheckOut from Cygnus_HR_Employee_Attendance_Master where Id=IDENT_CURRENT('Cygnus_HR_Employee_Attendance_Master')
if(@CheckIn==getdate(). && @CheckOut is NULL)
{
Update Cygnus_HR_Employee_Attendance_Master set @CheckOut=@CheckIn.addHours(4) where EmployeeId = @EmployeeId and CheckOut=is NULL
}
END
答案 0 :(得分:1)
使用
SET @CheckOut = DATEADD(HH,4,@CheckIn)