insert into SGGLDB.dbo.CostGoods_Expense select * from SUBHSSEDB.dbo.CostGoods_Expense
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.CostGoods_ExpenseDetail select * from SUBHSSEDB.dbo.CostGoods_ExpenseDetail
where ExpenseId in (select ExpenseId from SGGLDB.dbo.CostGoods_Expense)
go
insert into SGGLDB.dbo.CostGoods_CostManage select * from SUBHSSEDB.dbo.CostGoods_CostManage
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.CostGoods_CostManageItem select * from SUBHSSEDB.dbo.CostGoods_CostManageItem
where CostManageId in (select CostManageId from SGGLDB.dbo.CostGoods_CostManage)
go
insert into SGGLDB.dbo.CostGoods_CostSmallDetail select * from SUBHSSEDB.dbo.CostGoods_CostSmallDetail
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.CostGoods_CostSmallDetailItem select * from SUBHSSEDB.dbo.CostGoods_CostSmallDetailItem
where CostSmallDetailId in (select CostSmallDetailId from SGGLDB.dbo.CostGoods_CostSmallDetail)
go
insert into SGGLDB.dbo.InApproveManager_EquipmentIn select * from SUBHSSEDB.dbo.InApproveManager_EquipmentIn
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.InApproveManager_EquipmentInItem select * from SUBHSSEDB.dbo.InApproveManager_EquipmentInItem
where EquipmentInId in (select EquipmentInId from SGGLDB.dbo.InApproveManager_EquipmentIn)
go
insert into SGGLDB.dbo.InApproveManager_EquipmentOut select * from SUBHSSEDB.dbo.InApproveManager_EquipmentOut
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.InApproveManager_EquipmentOutItem select * from SUBHSSEDB.dbo.InApproveManager_EquipmentOutItem
where EquipmentOutId in (select EquipmentOutId from SGGLDB.dbo.InApproveManager_EquipmentOut)
go
insert into SGGLDB.dbo.InApproveManager_GeneralEquipmentIn select * from SUBHSSEDB.dbo.InApproveManager_GeneralEquipmentIn
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.InApproveManager_GeneralEquipmentInItem select * from SUBHSSEDB.dbo.InApproveManager_GeneralEquipmentInItem
where GeneralEquipmentInId in (select GeneralEquipmentInId from SGGLDB.dbo.InApproveManager_GeneralEquipmentIn)
go
insert into SGGLDB.dbo.InApproveManager_GeneralEquipmentOut select * from SUBHSSEDB.dbo.InApproveManager_GeneralEquipmentOut
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.InApproveManager_GeneralEquipmentOutItem select * from SUBHSSEDB.dbo.InApproveManager_GeneralEquipmentOutItem
where GeneralEquipmentOutId in (select GeneralEquipmentOutId from SGGLDB.dbo.InApproveManager_GeneralEquipmentOut)
go
insert into SGGLDB.dbo.InApproveManager_EquipmentQualityIn select * from SUBHSSEDB.dbo.InApproveManager_EquipmentQualityIn
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.InApproveManager_EquipmentQualityInItem select * from SUBHSSEDB.dbo.InApproveManager_EquipmentQualityInItem
where EquipmentQualityInId in (select EquipmentQualityInId from SGGLDB.dbo.InApproveManager_EquipmentQualityIn)
go

insert into SGGLDB.dbo.QualityAudit_EquipmentQuality select * from SUBHSSEDB.dbo.QualityAudit_EquipmentQuality
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.QualityAudit_EquipmentQualityAuditDetail select * from SUBHSSEDB.dbo.QualityAudit_EquipmentQualityAuditDetail
where EquipmentQualityId in (select EquipmentQualityId from SGGLDB.dbo.QualityAudit_EquipmentQuality)
go
insert into SGGLDB.dbo.QualityAudit_GeneralEquipmentQuality select * from SUBHSSEDB.dbo.QualityAudit_GeneralEquipmentQuality
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.Check_IncentiveNotice (IncentiveNoticeId,ProjectId,IncentiveNoticeCode,UnitId,IncentiveDate,PersonId,BasicItem,IncentiveMoney
,TitleReward,MattleReward,FileContents,AttachUrl,CompileMan,CompileDate,States,SignMan,ApproveMan,RewardType,TeamGroupId,Currency)
select IncentiveNoticeId,ProjectId,IncentiveNoticeCode,UnitId,IncentiveDate,PersonId,BasicItem,IncentiveMoney
,TitleReward,MattleReward,FileContents,AttachUrl,CompileMan,CompileDate,States,SignMan,ApproveMan,RewardType,TeamGroupId,Currency
 from SUBHSSEDB.dbo.Check_IncentiveNotice
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.Emergency_EmergencyList select * from SUBHSSEDB.dbo.Emergency_EmergencyList
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.Emergency_EmergencySupply select * from SUBHSSEDB.dbo.Emergency_EmergencySupply
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.Emergency_EmergencyTeamAndTrain select * from SUBHSSEDB.dbo.Emergency_EmergencyTeamAndTrain
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.Emergency_EmergencyTeamItem select * from SUBHSSEDB.dbo.Emergency_EmergencyTeamItem
where FileId in (select FileId from SGGLDB.dbo.Emergency_EmergencyTeamAndTrain)
go
insert into SGGLDB.dbo.Emergency_EmergencyProcess (EmergencyProcessId,ProjectId,ProcessSteps,ProcessName,StepOperator,Remark)
select EmergencyProcessId,ProjectId,ProcessSteps,ProcessName,StepOperator,Remark
from SUBHSSEDB.dbo.Emergency_EmergencyProcess
where (ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)) OR ProjectId IS NULL
go
insert into SGGLDB.dbo.Accident_AccidentHandle select * from SUBHSSEDB.dbo.Accident_AccidentHandle
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.Accident_AccidentReport select * from SUBHSSEDB.dbo.Accident_AccidentReport
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.Accident_AccidentReportOther select * from SUBHSSEDB.dbo.Accident_AccidentReportOther
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.Accident_AccidentReportOtherItem select * from SUBHSSEDB.dbo.Accident_AccidentReportOtherItem
where AccidentReportOtherId in (select AccidentReportOtherId from SGGLDB.dbo.Accident_AccidentReportOther)
go
insert into SGGLDB.dbo.Accident_NoFourLetoff select * from SUBHSSEDB.dbo.Accident_NoFourLetoff
where AccidentHandleId in (select AccidentHandleId from SGGLDB.dbo.Accident_AccidentHandle)
go
insert into SGGLDB.dbo.Accident_AccidentPersonRecord select * from SUBHSSEDB.dbo.Accident_AccidentPersonRecord
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go