--½ÌÓýÅàѵ insert into SGGLDB.dbo.EduTrain_TrainRecord(TrainingId,TrainingCode,ProjectId,TrainTitle,TrainContent,TrainStartDate,TrainEndDate,TeachHour ,TeachMan,TeachAddress,Remark,TrainTypeId,TrainLevelId,AttachUrl,UnitIds,States,CompileMan,TrainPersonNum ,FromRecordId,WorkPostIds,PlanId) select TrainingId,TrainingCode,ProjectId,TrainTitle,TrainContent,TrainStartDate,TrainEndDate,TeachHour ,TeachMan,TeachAddress,Remark,TrainTypeId,TrainLevelId,AttachUrl,UnitIds,States,CompileMan,TrainPersonNum ,FromRecordId,WorkPostIds,PlanId from SUBHSSEDB.dbo.EduTrain_TrainRecord as s where s.ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project) AND s.TrainingId NOT IN (select TrainingId from SGGLDB.dbo.EduTrain_TrainRecord) go insert into SGGLDB.dbo.EduTrain_TrainRecordDetail select * from SUBHSSEDB.dbo.EduTrain_TrainRecordDetail as s where s.TrainingId in (select TrainingId from SGGLDB.dbo.EduTrain_TrainRecord) AND s.TrainDetailId NOT IN (select TrainDetailId from SGGLDB.dbo.EduTrain_TrainRecordDetail) go insert into SGGLDB.dbo.EduTrain_TrainPersonRecord select * from SUBHSSEDB.dbo.EduTrain_TrainPersonRecord as s where s.ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project) AND s.ID NOT IN (select ID from SGGLDB.dbo.EduTrain_TrainPersonRecord) go insert into SGGLDB.dbo.EduTrain_TrainTest select * from SUBHSSEDB.dbo.EduTrain_TrainTest as s where s.TrainTestId NOT IN (select TrainTestId from SGGLDB.dbo.EduTrain_TrainTest) go insert into SGGLDB.dbo.Base_Unit(UnitId,UnitCode,UnitName,ShortUnitName,UnitTypeId,ProjectRange,Corporate,Address,Telephone,Fax,EMail ,IsBuild,IsBranch,DataSources,FromUnitId,SupUnitId) select UnitId,UnitCode,UnitName,ShortUnitName,UnitTypeId,ProjectRange,Corporate,Address,Telephone,Fax,EMail ,IsBuild,IsBranch,DataSources,FromUnitId,SupUnitId from SUBHSSEDB.dbo.Base_Unit as s where s.UnitId NOT IN (select UnitId from SGGLDB.dbo.Base_Unit) and UnitId in (select distinct b.UnitId from SGGLDB.dbo.EduTrain_TrainRecordDetail as a left join SGGLDB.dbo.EduTrain_TrainRecord as e on a.TrainingId=e.TrainingId left join SUBHSSEDB.dbo.SitePerson_Person as b on a.PersonId=b.PersonId where e.ProjectId !='e0356a29-984a-4bb3-a515-e69d5c0f7c78') go insert into SGGLDB.dbo.Base_WorkPost(WorkPostId,WorkPostName,WorkPostCode,Remark,PostType,IsHsse) select WorkPostId,WorkPostName,WorkPostCode,'HSEµ¼Èë',PostType,IsHsse from SUBHSSEDB.dbo.Base_WorkPost as s where s.WorkPostId NOT IN (select WorkPostId from SGGLDB.dbo.Base_WorkPost) and WorkPostId in (select distinct b.WorkPostId from SGGLDB.dbo.EduTrain_TrainRecordDetail as a left join SGGLDB.dbo.EduTrain_TrainRecord as e on a.TrainingId=e.TrainingId left join SUBHSSEDB.dbo.SitePerson_Person as b on a.PersonId=b.PersonId where e.ProjectId !='e0356a29-984a-4bb3-a515-e69d5c0f7c78') go insert into SGGLDB.dbo.SitePerson_Person(PersonId,CardNo,PersonName,Sex,IdentityCard,Address,ProjectId,UnitId,TeamGroupId,WorkAreaId,WorkPostId,InTime ,OutTime,OutResult,Telephone,PositionId,PostTitleId,PhotoUrl,IsUsed,IsCardUsed,PersonIndex,DepartId,CertificateId,CertificateCode ,CertificateLimitTime,QualificationCertificateUrl,TrainingCertificateUrl,QRCodeAttachUrl,Password,FromPersonId,AuditorId ,AuditorDate,ExchangeTime,ExchangeTime2,IDCardUrl,isprint,IsForeign,IsOutside) select PersonId,CardNo,PersonName,Sex,IdentityCard,Address,ProjectId,UnitId,TeamGroupId,WorkAreaId,WorkPostId,InTime ,OutTime,OutResult,Telephone,PositionId,PostTitleId,PhotoUrl,IsUsed,IsCardUsed,PersonIndex,DepartId,CertificateId,CertificateCode ,CertificateLimitTime,QualificationCertificateUrl,TrainingCertificateUrl,QRCodeAttachUrl,Password,FromPersonId,AuditorId ,AuditorDate,ExchangeTime,ExchangeTime2,IDCardUrl,isprint,IsForeign,IsOutside from SUBHSSEDB.dbo.SitePerson_Person as s where s.ProjectId in (select ProjectId from SGGLDB.dbo.Base_Project) AND s.PersonId NOT IN (select PersonId from SGGLDB.dbo.SitePerson_Person) and PersonId in (select a.PersonId from SGGLDB.dbo.EduTrain_TrainRecordDetail as a left join SGGLDB.dbo.EduTrain_TrainRecord as e on a.TrainingId=e.TrainingId left join SGGLDB.dbo.SitePerson_Person as b on a.PersonId=b.PersonId where b.PersonId is null and e.ProjectId !='e0356a29-984a-4bb3-a515-e69d5c0f7c78') go