CNCEC_SUBQHSE_WUHUAN/DataBase/初始化及数据迁移/2020-07-08HSSE-数据迁移脚本.sql

105 lines
6.7 KiB
Transact-SQL

insert into SGGLDB.dbo.Manager_CompletionReport select * from SUBHSSEDB.dbo.Manager_CompletionReport
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
--insert into SGGLDB.dbo.Project_HSEDiary select * from SUBHSSEDB.dbo.Project_HSEDiary
--where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
--go
--insert into SGGLDB.dbo.SeDin_MonthReport select * from SUBHSSEDB.dbo.SeDin_MonthReport
--where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
--go
--insert into SGGLDB.dbo.SeDin_MonthReport1 select * from SUBHSSEDB.dbo.SeDin_MonthReport1
--where MonthReportId in (select MonthReportId from SGGLDB.dbo.SeDin_MonthReport)
--go
--insert into SGGLDB.dbo.SeDin_MonthReport2 select * from SUBHSSEDB.dbo.SeDin_MonthReport2
--where MonthReportId in (select MonthReportId from SGGLDB.dbo.SeDin_MonthReport)
--go
--insert into SGGLDB.dbo.SeDin_MonthReport3 select * from SUBHSSEDB.dbo.SeDin_MonthReport3
--where MonthReportId in (select MonthReportId from SGGLDB.dbo.SeDin_MonthReport)
--go
--insert into SGGLDB.dbo.SeDin_MonthReport4 select * from SUBHSSEDB.dbo.SeDin_MonthReport4
--where MonthReportId in (select MonthReportId from SGGLDB.dbo.SeDin_MonthReport)
--go
--insert into SGGLDB.dbo.SeDin_MonthReport5 select * from SUBHSSEDB.dbo.SeDin_MonthReport5
--where MonthReportId in (select MonthReportId from SGGLDB.dbo.SeDin_MonthReport)
--go
--insert into SGGLDB.dbo.SeDin_MonthReport6 select * from SUBHSSEDB.dbo.SeDin_MonthReport6
--where MonthReportId in (select MonthReportId from SGGLDB.dbo.SeDin_MonthReport)
--go
--insert into SGGLDB.dbo.SeDin_MonthReport7 select * from SUBHSSEDB.dbo.SeDin_MonthReport7
--where MonthReportId in (select MonthReportId from SGGLDB.dbo.SeDin_MonthReport)
--go
--insert into SGGLDB.dbo.SeDin_MonthReport8 select * from SUBHSSEDB.dbo.SeDin_MonthReport8
--where MonthReportId in (select MonthReportId from SGGLDB.dbo.SeDin_MonthReport)
--go
--insert into SGGLDB.dbo.SeDin_MonthReport8Item select * from SUBHSSEDB.dbo.SeDin_MonthReport8Item
--where MonthReportId in (select MonthReportId from SGGLDB.dbo.SeDin_MonthReport)
--go
--insert into SGGLDB.dbo.SeDin_MonthReport9 select * from SUBHSSEDB.dbo.SeDin_MonthReport9
--where MonthReportId in (select MonthReportId from SGGLDB.dbo.SeDin_MonthReport)
--go
--insert into SGGLDB.dbo.SeDin_MonthReport9Item_Rectification select * from SUBHSSEDB.dbo.SeDin_MonthReport9Item_Rectification
--where MonthReportId in (select MonthReportId from SGGLDB.dbo.SeDin_MonthReport)
--go
--insert into SGGLDB.dbo.SeDin_MonthReport9Item_Special select * from SUBHSSEDB.dbo.SeDin_MonthReport9Item_Special
--where MonthReportId in (select MonthReportId from SGGLDB.dbo.SeDin_MonthReport)
--go
--insert into SGGLDB.dbo.SeDin_MonthReport9Item_Stoppage select * from SUBHSSEDB.dbo.SeDin_MonthReport9Item_Stoppage
--where MonthReportId in (select MonthReportId from SGGLDB.dbo.SeDin_MonthReport)
--go
--insert into SGGLDB.dbo.SeDin_MonthReport10 select * from SUBHSSEDB.dbo.SeDin_MonthReport10
--where MonthReportId in (select MonthReportId from SGGLDB.dbo.SeDin_MonthReport)
--go
--insert into SGGLDB.dbo.SeDin_MonthReport11 select * from SUBHSSEDB.dbo.SeDin_MonthReport11
--where MonthReportId in (select MonthReportId from SGGLDB.dbo.SeDin_MonthReport)
--go
--insert into SGGLDB.dbo.SeDin_MonthReport12 select * from SUBHSSEDB.dbo.SeDin_MonthReport12
--where MonthReportId in (select MonthReportId from SGGLDB.dbo.SeDin_MonthReport)
--go
insert into SGGLDB.dbo.InformationProject_Notice select * from SUBHSSEDB.dbo.InformationProject_Notice
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project) OR ProjectId IS NULL
go
insert into SGGLDB.dbo.InformationProject_Picture select * from SUBHSSEDB.dbo.InformationProject_Picture
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.InformationProject_ProjectMap select * from SUBHSSEDB.dbo.InformationProject_ProjectMap
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.InformationProject_ReceiveFileManager (ReceiveFileManagerId,ProjectId,ReceiveFileCode,ReceiveFileName,Version,FileUnitId,FileCode
,FilePageNum,GetFileDate,SendPersonId,MainContent,AttachUrl,States,UnitIds,FileType)
select ReceiveFileManagerId,ProjectId,ReceiveFileCode,ReceiveFileName,Version,FileUnitId,FileCode
,FilePageNum,GetFileDate,SendPersonId,MainContent,AttachUrl,States,UnitIds,FileType
from SUBHSSEDB.dbo.InformationProject_ReceiveFileManager
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.Wx_PageData select * from SUBHSSEDB.dbo.Wx_PageData
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.InformationProject_MillionsMonthlyReport select * from SUBHSSEDB.dbo.InformationProject_MillionsMonthlyReport
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.InformationProject_AccidentCauseReport select * from SUBHSSEDB.dbo.InformationProject_AccidentCauseReport
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.InformationProject_AccidentCauseReportItem select * from SUBHSSEDB.dbo.InformationProject_AccidentCauseReportItem
where AccidentCauseReportId in (select AccidentCauseReportId from SGGLDB.dbo.InformationProject_AccidentCauseReport)
go
insert into SGGLDB.dbo.InformationProject_SafetyQuarterlyReport select * from SUBHSSEDB.dbo.InformationProject_SafetyQuarterlyReport
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.InformationProject_DrillConductedQuarterlyReport select * from SUBHSSEDB.dbo.InformationProject_DrillConductedQuarterlyReport
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.InformationProject_DrillConductedQuarterlyReportItem select * from SUBHSSEDB.dbo.InformationProject_DrillConductedQuarterlyReportItem
where DrillConductedQuarterlyReportId in (select DrillConductedQuarterlyReportId from SGGLDB.dbo.InformationProject_DrillConductedQuarterlyReport)
go
insert into SGGLDB.dbo.InformationProject_DrillPlanHalfYearReport select * from SUBHSSEDB.dbo.InformationProject_DrillPlanHalfYearReport
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.InformationProject_DrillPlanHalfYearReportItem select * from SUBHSSEDB.dbo.InformationProject_DrillPlanHalfYearReportItem
where DrillPlanHalfYearReportId in (select DrillPlanHalfYearReportId from SGGLDB.dbo.InformationProject_DrillPlanHalfYearReport)
go
insert into SGGLDB.dbo.ProjectSupervision_ProjectEvaluation select * from SUBHSSEDB.dbo.ProjectSupervision_ProjectEvaluation
where ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project)
go
insert into SGGLDB.dbo.HSSESystem_SafetyInstitution select * from SUBHSSEDB.dbo.HSSESystem_SafetyInstitution
go