294 lines
		
	
	
		
			9.7 KiB
		
	
	
	
		
			MySQL
		
	
	
	
		
		
			
		
	
	
			294 lines
		
	
	
		
			9.7 KiB
		
	
	
	
		
			MySQL
		
	
	
	
|  | --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_ManagerWeek  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_ManagerWeek as s
 | |||
|  | where s.ProjectId in (select ProjectId from SGGLDB_WH.dbo.Base_Project) 
 | |||
|  | AND s.ManagerWeekId NOT IN (select ManagerWeekId from SGGLDB_WH.dbo.Manager_ManagerWeek) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_MonthReport  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_MonthReport as s
 | |||
|  | where s.ProjectId in (select ProjectId from SGGLDB_WH.dbo.Base_Project) 
 | |||
|  | AND s.MonthReportId NOT IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReport) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_CompletionReport  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_CompletionReport as s
 | |||
|  | where s.ProjectId in (select ProjectId from SGGLDB_WH.dbo.Base_Project) 
 | |||
|  | AND s.CompletionReportId NOT IN (select CompletionReportId from SGGLDB_WH.dbo.Manager_CompletionReport) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_MonthReportB  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_MonthReportB as s
 | |||
|  | where s.ProjectId in (select ProjectId from SGGLDB_WH.dbo.Base_Project) 
 | |||
|  | AND s.MonthReportId NOT IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportB) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_MonthReportC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_MonthReportC as s
 | |||
|  | where s.ProjectId in (select ProjectId from SGGLDB_WH.dbo.Base_Project) 
 | |||
|  | AND s.MonthReportId NOT IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_MonthReportD  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_MonthReportD as s
 | |||
|  | where s.ProjectId in (select ProjectId from SGGLDB_WH.dbo.Base_Project) 
 | |||
|  | AND s.MonthReportId NOT IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportD) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_MonthReportE  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_MonthReportE as s
 | |||
|  | where s.ProjectId in (select ProjectId from SGGLDB_WH.dbo.Base_Project) 
 | |||
|  | AND s.MonthReportId NOT IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportE) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_SafetyDataD  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_SafetyDataD as s
 | |||
|  | where s.MonthReportId in (select ProjectId from SGGLDB_WH.dbo.Manager_MonthReportD) 
 | |||
|  | AND s.SafetyDataId NOT IN (select SafetyDataId from SGGLDB_WH.dbo.Manager_SafetyDataD) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_SubManagerMonth  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_SubManagerMonth as s
 | |||
|  | where s.ProjectId in (select ProjectId from SGGLDB_WH.dbo.Base_Project) 
 | |||
|  | AND s.SubManagerMonthId NOT IN (select SubManagerMonthId from SGGLDB_WH.dbo.Manager_SubManagerMonth) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_SubManagerWeek  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_SubManagerWeek as s
 | |||
|  | where s.ProjectId in (select ProjectId from SGGLDB_WH.dbo.Base_Project) 
 | |||
|  | AND s.SubManagerWeekId NOT IN (select SubManagerWeekId from SGGLDB_WH.dbo.Manager_SubManagerWeek) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_SubUploadWeek  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_SubUploadWeek as s
 | |||
|  | where s.ProjectId in (select ProjectId from SGGLDB_WH.dbo.Base_Project) 
 | |||
|  | AND s.SubUploadWeekId NOT IN (select SubUploadWeekId from SGGLDB_WH.dbo.Manager_SubUploadWeek) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_AccidentSortC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_AccidentSortC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_CheckDetailSortC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_CheckDetailSortC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_CheckSortC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_CheckSortC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_DrillSortC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_DrillSortC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_EmergencySortC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_EmergencySortC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_HazardSortC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_HazardSortC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_HseCostC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_HseCostC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_MeetingSortC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_MeetingSortC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_Month_AccidentDesciptionC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_Month_AccidentDesciptionC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_Month_AccidentDesciptionItemC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_Month_AccidentDesciptionItemC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_Month_ActivitiesC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_Month_ActivitiesC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_Month_ActivityDesC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_Month_ActivityDesC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_Month_CheckC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_Month_CheckC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_Month_CostInvestmentPlanC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_Month_CostInvestmentPlanC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_Month_EmergencyExercisesC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_Month_EmergencyExercisesC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_Month_EmergencyPlanC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_Month_EmergencyPlanC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_Month_FileManageC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_Month_FileManageC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_Month_FiveExpenseC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_Month_FiveExpenseC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_Month_HazardC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_Month_HazardC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_Month_ManageDocPlanC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_Month_ManageDocPlanC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_Month_MeetingC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_Month_MeetingC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_Month_OtherManagementC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_Month_OtherManagementC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_Month_OtherWorkC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_Month_OtherWorkC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_Month_OtherWorkPlanC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_Month_OtherWorkPlanC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_Month_PlanC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_Month_PlanC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_Month_ReviewRecordC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_Month_ReviewRecordC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_Month_SubExpenseC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_Month_SubExpenseC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_Month_TrainC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_Month_TrainC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_OtherActiveSortC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_OtherActiveSortC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_PersonSortC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_PersonSortC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_PromotionalActiviteSortC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_PromotionalActiviteSortC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_TrainActivitySortC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_TrainActivitySortC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 | |||
|  | 
 | |||
|  | insert into SGGLDB_WH.dbo.Manager_TrainSortC  
 | |||
|  | select *
 | |||
|  | from SUBHSSEDB_WH.dbo.Manager_TrainSortC as s
 | |||
|  | where s.MonthReportId IN (select MonthReportId from SGGLDB_WH.dbo.Manager_MonthReportC) 
 | |||
|  | go
 |