Files
SGGL_SHJ/DataBase/版本日志/已更新脚本/初始化及数据迁移/2020-07-07HSSE-数据迁移脚本.sql
T
2022-09-05 16:36:31 +08:00

94 lines
5.8 KiB
Transact-SQL

insert into SGGLDB.dbo.CostGoods_Expense select * from HSSEDB.dbo.CostGoods_Expense
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.CostGoods_ExpenseDetail select * from HSSEDB.dbo.CostGoods_ExpenseDetail
where ExpenseId in (select ExpenseId from SGGLDB.dbo.CostGoods_Expense)
go
insert into SGGLDB.dbo.CostGoods_CostManage select * from HSSEDB.dbo.CostGoods_CostManage
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.CostGoods_CostManageItem select * from HSSEDB.dbo.CostGoods_CostManageItem
where CostManageId in (select CostManageId from SGGLDB.dbo.CostGoods_CostManage)
go
insert into SGGLDB.dbo.CostGoods_CostSmallDetail select * from HSSEDB.dbo.CostGoods_CostSmallDetail
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.CostGoods_CostSmallDetailItem select * from HSSEDB.dbo.CostGoods_CostSmallDetailItem
where CostSmallDetailId in (select CostSmallDetailId from SGGLDB.dbo.CostGoods_CostSmallDetail)
go
insert into SGGLDB.dbo.InApproveManager_EquipmentIn select * from HSSEDB.dbo.InApproveManager_EquipmentIn
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.InApproveManager_EquipmentInItem select * from HSSEDB.dbo.InApproveManager_EquipmentInItem
where EquipmentInId in (select EquipmentInId from SGGLDB.dbo.InApproveManager_EquipmentIn)
go
insert into SGGLDB.dbo.InApproveManager_EquipmentOut select * from HSSEDB.dbo.InApproveManager_EquipmentOut
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.InApproveManager_EquipmentOutItem select * from HSSEDB.dbo.InApproveManager_EquipmentOutItem
where EquipmentOutId in (select EquipmentOutId from SGGLDB.dbo.InApproveManager_EquipmentOut)
go
insert into SGGLDB.dbo.InApproveManager_GeneralEquipmentIn select * from HSSEDB.dbo.InApproveManager_GeneralEquipmentIn
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.InApproveManager_GeneralEquipmentInItem select * from HSSEDB.dbo.InApproveManager_GeneralEquipmentInItem
where GeneralEquipmentInId in (select GeneralEquipmentInId from SGGLDB.dbo.InApproveManager_GeneralEquipmentIn)
go
insert into SGGLDB.dbo.InApproveManager_GeneralEquipmentOut select * from HSSEDB.dbo.InApproveManager_GeneralEquipmentOut
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.InApproveManager_GeneralEquipmentOutItem select * from HSSEDB.dbo.InApproveManager_GeneralEquipmentOutItem
where GeneralEquipmentOutId in (select GeneralEquipmentOutId from SGGLDB.dbo.InApproveManager_GeneralEquipmentOut)
go
insert into SGGLDB.dbo.InApproveManager_EquipmentQualityIn select * from HSSEDB.dbo.InApproveManager_EquipmentQualityIn
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.InApproveManager_EquipmentQualityInItem select * from HSSEDB.dbo.InApproveManager_EquipmentQualityInItem
where EquipmentQualityInId in (select EquipmentQualityInId from SGGLDB.dbo.InApproveManager_EquipmentQualityIn)
go
insert into SGGLDB.dbo.QualityAudit_EquipmentQuality select * from HSSEDB.dbo.QualityAudit_EquipmentQuality
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.QualityAudit_EquipmentQualityAuditDetail select * from HSSEDB.dbo.QualityAudit_EquipmentQualityAuditDetail
where EquipmentQualityId in (select EquipmentQualityId from SGGLDB.dbo.QualityAudit_EquipmentQuality)
go
insert into SGGLDB.dbo.QualityAudit_GeneralEquipmentQuality select * from HSSEDB.dbo.QualityAudit_GeneralEquipmentQuality
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.Check_IncentiveNotice select * from HSSEDB.dbo.Check_IncentiveNotice
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.Emergency_EmergencyList select * from HSSEDB.dbo.Emergency_EmergencyList
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.Emergency_EmergencySupply select * from HSSEDB.dbo.Emergency_EmergencySupply
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.Emergency_EmergencyTeamAndTrain select * from HSSEDB.dbo.Emergency_EmergencyTeamAndTrain
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.Emergency_EmergencyTeamItem select * from HSSEDB.dbo.Emergency_EmergencyTeamItem
where FileId in (select FileId from SGGLDB.dbo.Emergency_EmergencyTeamAndTrain)
go
insert into SGGLDB.dbo.Emergency_EmergencyProcess select * from HSSEDB.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 HSSEDB.dbo.Accident_AccidentHandle
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.Accident_AccidentReport select * from HSSEDB.dbo.Accident_AccidentReport
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.Accident_AccidentReportOther select * from HSSEDB.dbo.Accident_AccidentReportOther
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.Accident_AccidentReportOtherItem select * from HSSEDB.dbo.Accident_AccidentReportOtherItem
where AccidentReportOtherId in (select AccidentReportOtherId from SGGLDB.dbo.Accident_AccidentReportOther)
go
insert into SGGLDB.dbo.Accident_NoFourLetoff select * from HSSEDB.dbo.Accident_NoFourLetoff
where AccidentHandleId in (select AccidentHandleId from SGGLDB.dbo.Accident_AccidentHandle)
go
insert into SGGLDB.dbo.Accident_AccidentPersonRecord select * from HSSEDB.dbo.Accident_AccidentPersonRecord
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go