Project

General

Profile

Bug #2484 » query generate pws.txt

Muhammad Bintar, 01/10/2024 04:24 PM

 
1
DECLARE @toinsertmd125 TABLE
2
        (
3
		 [landscape] VARCHAR(20)
4
           ,[emp_id] VARCHAR(20)
5
           ,[start_date] VARCHAR(20)
6
           ,[end_date] VARCHAR(20)
7
           ,[day_type] VARCHAR(20)
8
           ,[ph_id] VARCHAR(20)
9
           ,[user_change] VARCHAR(50)
10
           ,[last_change] VARCHAR(50)
11
           ,[created_by] VARCHAR(50)
12
           ,[created_date] VARCHAR(50)
13
        )
14
	insert into @toinsertmd125
15
select md25.landscape, md25.emp_id, cal.datespecified, cal.datespecified,cal.day_type,cal.ph_id, 'system' ,  FORMAT(getdate(),'yyyyMMddHHmmss'), 'system',FORMAT(getdate(),'yyyyMMddHHmmss') from hr_md_emp_md0025 md25
16
left join hr_tm_workschedule_calender cal on md25.ws_type = cal.workschedule_type 
17
              and cal.year= '2024'
18
where md25.ws_type = 'OVT' and md25.start_date = '20240101'
19

    
20
--SELECT * FROM @toinsertmd125
21
INSERT INTO  dbo.hr_md_emp_md0125 
22
SELECT DISTINCT  landscape,[emp_id],[start_date],[end_date],[day_type],[ph_id],[user_change],[last_change],[created_by],[created_date] FROM @toinsertmd125
(2-2/3)