INSERT INTO [dbo].[DB_OSP_ABSENCE]([Master_Id],[Start_Date],[Reason],[End_Date],[Unpaid],[Half_Day_Start],[Half_Day_End],[Completed_Absence],[Legacy_Record])
VALUES((SELECT TOP 1 Right_Join FROM LNK_EMPLOYEE_CONTRACT INNER JOIN DT_EMPLOYEE
ON Left_Join = Entity_Id AND CAST(EmployeeID as varchar(20)) = 'B647'
AND '19 Jan 2023' BETWEEN Start_Date AND ISNULL(End_Date, '31 dec 2499')),'19 Jan 2023','Sick','20 Jan 2023', 0,0,0,-1,-1)
INSERT INTO [dbo].[DB_OSP_ABSENCE]([Master_Id],[Start_Date],[Reason],[End_Date],[Unpaid],[Half_Day_Start],[Half_Day_End],[Completed_Absence],[Legacy_Record])
VALUES((SELECT TOP 1 Right_Join FROM LNK_EMPLOYEE_CONTRACT INNER JOIN DT_EMPLOYEE
ON Left_Join = Entity_Id AND CAST(EmployeeID as varchar(20)) = 'B1103'
AND '13 Mar 2023' BETWEEN Start_Date AND ISNULL(End_Date, '31 dec 2499')),'13 Mar 2023','Sick','14 Mar 2023', 0,0,0,-1,-1)
INSERT INTO [dbo].[DB_OSP_ABSENCE]([Master_Id],[Start_Date],[Reason],[End_Date],[Unpaid],[Half_Day_Start],[Half_Day_End],[Completed_Absence],[Legacy_Record])
VALUES((SELECT TOP 1 Right_Join FROM LNK_EMPLOYEE_CONTRACT INNER JOIN DT_EMPLOYEE
ON Left_Join = Entity_Id AND CAST(EmployeeID as varchar(20)) = 'B1366'
AND '28 Nov 2022' BETWEEN Start_Date AND ISNULL(End_Date, '31 dec 2499')),'28 Nov 2022','Sick','28 Nov 2022', 0,0,0,-1,-1)
INSERT INTO [dbo].[DB_OSP_ABSENCE]([Master_Id],[Start_Date],[Reason],[End_Date],[Unpaid],[Half_Day_Start],[Half_Day_End],[Completed_Absence],[Legacy_Record])
VALUES((SELECT TOP 1 Right_Join FROM LNK_EMPLOYEE_CONTRACT INNER JOIN DT_EMPLOYEE
ON Left_Join = Entity_Id AND CAST(EmployeeID as varchar(20)) = 'B1680'
AND '31 May 2023' BETWEEN Start_Date AND ISNULL(End_Date, '31 dec 2499')),'31 May 2023','Sick','06 Jun 2023', 0,-1,0,-1,-1)
INSERT INTO [dbo].[DB_OSP_ABSENCE]([Master_Id],[Start_Date],[Reason],[End_Date],[Unpaid],[Half_Day_Start],[Half_Day_End],[Completed_Absence],[Legacy_Record])
VALUES((SELECT TOP 1 Right_Join FROM LNK_EMPLOYEE_CONTRACT INNER JOIN DT_EMPLOYEE
ON Left_Join = Entity_Id AND CAST(EmployeeID as varchar(20)) = 'B1680'
AND '17 May 2023' BETWEEN Start_Date AND ISNULL(End_Date, '31 dec 2499')),'17 May 2023','Sick','17 May 2023', 0,-1,0,-1,-1)
INSERT INTO [dbo].[DB_OSP_ABSENCE]([Master_Id],[Start_Date],[Reason],[End_Date],[Unpaid],[Half_Day_Start],[Half_Day_End],[Completed_Absence],[Legacy_Record])
VALUES((SELECT TOP 1 Right_Join FROM LNK_EMPLOYEE_CONTRACT INNER JOIN DT_EMPLOYEE
ON Left_Join = Entity_Id AND CAST(EmployeeID as varchar(20)) = 'B1680'
AND '03 Jan 2023' BETWEEN Start_Date AND ISNULL(End_Date, '31 dec 2499')),'03 Jan 2023','Sick','03 Jan 2023', 0,0,0,-1,-1)
INSERT INTO [dbo].[DB_OSP_ABSENCE]([Master_Id],[Start_Date],[Reason],[End_Date],[Unpaid],[Half_Day_Start],[Half_Day_End],[Completed_Absence],[Legacy_Record])
VALUES((SELECT TOP 1 Right_Join FROM LNK_EMPLOYEE_CONTRACT INNER JOIN DT_EMPLOYEE
ON Left_Join = Entity_Id AND CAST(EmployeeID as varchar(20)) = 'B1680'
AND '19 Jul 2022' BETWEEN Start_Date AND ISNULL(End_Date, '31 dec 2499')),'19 Jul 2022','Sick','21 Jul 2022', 0,0,0,-1,-1)
INSERT INTO [dbo].[DB_OSP_ABSENCE]([Master_Id],[Start_Date],[Reason],[End_Date],[Unpaid],[Half_Day_Start],[Half_Day_End],[Completed_Absence],[Legacy_Record])
VALUES((SELECT TOP 1 Right_Join FROM LNK_EMPLOYEE_CONTRACT INNER JOIN DT_EMPLOYEE
ON Left_Join = Entity_Id AND CAST(EmployeeID as varchar(20)) = 'B3113'
AND '22 Feb 2023' BETWEEN Start_Date AND ISNULL(End_Date, '31 dec 2499')),'22 Feb 2023','Sick','22 Feb 2023', 0,0,0,-1,-1)
INSERT INTO [dbo].[DB_OSP_ABSENCE]([Master_Id],[Start_Date],[Reason],[End_Date],[Unpaid],[Half_Day_Start],[Half_Day_End],[Completed_Absence],[Legacy_Record])
VALUES((SELECT TOP 1 Right_Join FROM LNK_EMPLOYEE_CONTRACT INNER JOIN DT_EMPLOYEE
ON Left_Join = Entity_Id AND CAST(EmployeeID as varchar(20)) = 'B3113'
AND '09 Dec 2022' BETWEEN Start_Date AND ISNULL(End_Date, '31 dec 2499')),'09 Dec 2022','Sick','09 Dec 2022', 0,0,0,-1,-1)
INSERT INTO [dbo].[DB_OSP_ABSENCE]([Master_Id],[Start_Date],[Reason],[End_Date],[Unpaid],[Half_Day_Start],[Half_Day_End],[Completed_Absence],[Legacy_Record])
VALUES((SELECT TOP 1 Right_Join FROM LNK_EMPLOYEE_CONTRACT INNER JOIN DT_EMPLOYEE
ON Left_Join = Entity_Id AND CAST(EmployeeID as varchar(20)) = 'B3113'
AND '05 Dec 2022' BETWEEN Start_Date AND ISNULL(End_Date, '31 dec 2499')),'05 Dec 2022','Sick','07 Dec 2022', 0,0,0,-1,-1)
