text: -- =====================================================================================================
  -- Generated by Data Dictionary Version 1.0.0.0
  -- Date: 26 August 2016 11:10
  -- Profile: Test Harness Validation
  -- Rulebase Version: ILR Validation Learner 1617, Drop 000, Version 1617.05
  -- =====================================================================================================
  use [$(IntrajobDatabase)]
  go
  insert into
  	[Valid].[LearningProvider]
  		(
  			[LearningProvider_Id],
  			[UKPRN]
  		)
  select
  	[LearningProvider_Id],
  	[UKPRN]
  from
  	[$(FromILRDatabase)].[$(FromILRSchema)].[LearningProviderDenorm] LearningProvider
  where
  	[LearningProvider].[UKPRN]=$(UKPRN)
  go
  
  insert into
  	[Valid].[CollectionDetails]
  		(
  			[CollectionDetails_Id],
  			[FilePreparationDate]
  		)
  select
  	[CollectionDetails_Id],
  	[FilePreparationDate]
  from
  	[$(FromILRDatabase)].[$(FromILRSchema)].[CollectionDetailsDenorm] CollectionDetails
  where
  	[CollectionDetails].[UKPRN]=$(UKPRN)
  go
  
  insert into
  	[Valid].[Learner]
  		(
  			[Learner_Id],
  			[Accom],
  			[ALSCost],
  			[DateOfBirth],
  			[EngGrade],
  			[Ethnicity],
  			[FamilyName],
  			[GivenNames],
  			[LearnRefNumber],
  			[LLDDHealthProb],
  			[MathGrade],
  			[NINumber],
  			[PlanEEPHours],
  			[PlanLearnHours],
  			[PrevUKPRN],
  			[PriorAttain],
  			[Sex],
  			[ULN]
  		)
  select
  	[Learner_Id],
  	[Accom],
  	[ALSCost],
  	[DateOfBirth],
  	[EngGrade],
  	[Ethnicity],
  	[FamilyName],
  	[GivenNames],
  	[LearnRefNumber],
  	[LLDDHealthProb],
  	[MathGrade],
  	[NINumber],
  	[PlanEEPHours],
  	[PlanLearnHours],
  	[PrevUKPRN],
  	[PriorAttain],
  	[Sex],
  	[ULN]
  from
  	[$(FromILRDatabase)].[$(FromILRSchema)].[LearnerDenorm] Learner
  where
  	[Learner].[UKPRN]=$(UKPRN)
  go
  
  insert into
  	[Valid].[LearningDelivery]
  		(
  			[LearningDelivery_Id],
  			[AchDate],
  			[AddHours],
  			[AimSeqNumber],
  			[AimType],
  			[LearnAimRef],
  			[CompStatus],
  			[ConRefNumber],
  			[DelLocPostCode],
  			[EmpOutcome],
  			[FworkCode],
  			[ProgType],
  			[PwayCode],
  			[FundModel],
  			[LearnActEndDate],
  			[LearnPlanEndDate],
  			[LearnStartDate],
  			[OrigLearnStartDate],
  			[OtherFundAdj],
  			[Outcome],
  			[OutGrade],
  			[PartnerUKPRN],
  			[PriorLearnFundAdj],
  			[StdCode],
  			[SWSupAimId],
  			[WithdrawReason]
  		)
  select
  	[LearningDelivery_Id],
  	[AchDate],
  	[AddHours],
  	[AimSeqNumber],
  	[AimType],
  	[LearnAimRef],
  	[CompStatus],
  	[ConRefNumber],
  	[DelLocPostCode],
  	[EmpOutcome],
  	[FworkCode],
  	[ProgType],
  	[PwayCode],
  	[FundModel],
  	[LearnActEndDate],
  	[LearnPlanEndDate],
  	[LearnStartDate],
  	[OrigLearnStartDate],
  	[OtherFundAdj],
  	[Outcome],
  	[OutGrade],
  	[PartnerUKPRN],
  	[PriorLearnFundAdj],
  	[StdCode],
  	[SWSupAimId],
  	[WithdrawReason]
  from
  	[$(FromILRDatabase)].[$(FromILRSchema)].[LearningDeliveryDenorm] LearningDelivery
  where
  	[LearningDelivery].[UKPRN]=$(UKPRN)
  go
  
  insert into
  	[Valid].[LearningDeliveryFAM]
  		(
  			[LearningDeliveryFAM_Id],
  			[LearnDelFAMCode],
  			[LearnDelFAMDateFrom],
  			[LearnDelFAMDateTo],
  			[LearnDelFAMType]
  		)
  select
  	[LearningDeliveryFAM_Id],
  	[LearnDelFAMCode],
  	[LearnDelFAMDateFrom],
  	[LearnDelFAMDateTo],
  	[LearnDelFAMType]
  from
  	[$(FromILRDatabase)].[$(FromILRSchema)].[LearningDeliveryFAMDenorm] LearningDeliveryFAM
  where
  	[LearningDeliveryFAM].[UKPRN]=$(UKPRN)
  go
  
  insert into
  	[Valid].[LearningDeliveryHE]
  		(
  			[LearningDeliveryHE_Id],
  			[DOMICILE],
  			[ELQ],
  			[FUNDCOMP],
  			[FUNDLEV],
  			[GROSSFEE],
  			[HEPostCode],
  			[MODESTUD],
  			[MSTUFEE],
  			[NETFEE],
  			[NUMHUS],
  			[PCFLDCS],
  			[PCOLAB],
  			[PCSLDCS],
  			[PCTLDCS],
  			[QUALENT3],
  			[SEC],
  			[SOC2000],
  			[SPECFEE],
  			[SSN],
  			[STULOAD],
  			[TYPEYR],
  			[UCASAPPID]
  		)
  select
  	[LearningDeliveryHE_Id],
  	[DOMICILE],
  	[ELQ],
  	[FUNDCOMP],
  	[FUNDLEV],
  	[GROSSFEE],
  	[HEPostCode],
  	[MODESTUD],
  	[MSTUFEE],
  	[NETFEE],
  	[NUMHUS],
  	[PCFLDCS],
  	[PCOLAB],
  	[PCSLDCS],
  	[PCTLDCS],
  	[QUALENT3],
  	[SEC],
  	[SOC2000],
  	[SPECFEE],
  	[SSN],
  	[STULOAD],
  	[TYPEYR],
  	[UCASAPPID]
  from
  	[$(FromILRDatabase)].[$(FromILRSchema)].[LearningDeliveryHEDenorm] LearningDeliveryHE
  where
  	[LearningDeliveryHE].[UKPRN]=$(UKPRN)
  go
  
  insert into
  	[Valid].[ProviderSpecDeliveryMonitoring]
  		(
  			[ProviderSpecDeliveryMonitoring_Id],
  			[ProvSpecDelMon],
  			[ProvSpecDelMonOccur]
  		)
  select
  	[ProviderSpecDeliveryMonitoring_Id],
  	[ProvSpecDelMon],
  	[ProvSpecDelMonOccur]
  from
  	[$(FromILRDatabase)].[$(FromILRSchema)].[ProviderSpecDeliveryMonitoringDenorm] ProviderSpecDeliveryMonitoring
  where
  	[ProviderSpecDeliveryMonitoring].[UKPRN]=$(UKPRN)
  go
  
  insert into
  	[Valid].[LearningDeliveryWorkPlacement]
  		(
  			[LearningDeliveryWorkPlacement_Id],
  			[WorkPlaceEmpId],
  			[WorkPlaceEndDate],
  			[WorkPlaceMode],
  			[WorkPlaceStartDate]
  		)
  select
  	[LearningDeliveryWorkPlacement_Id],
  	[WorkPlaceEmpId],
  	[WorkPlaceEndDate],
  	[WorkPlaceMode],
  	[WorkPlaceStartDate]
  from
  	[$(FromILRDatabase)].[$(FromILRSchema)].[LearningDeliveryWorkPlacementDenorm] LearningDeliveryWorkPlacement
  where
  	[LearningDeliveryWorkPlacement].[UKPRN]=$(UKPRN)
  go
  
  insert into
  	[Valid].[TrailblazerApprenticeshipFinancialRecord]
  		(
  			[TrailblazerApprenticeshipFinancialRecord_Id],
  			[TBFinAmount],
  			[TBFinCode],
  			[TBFinDate],
  			[TBFinType]
  		)
  select
  	[TrailblazerApprenticeshipFinancialRecord_Id],
  	[TBFinAmount],
  	[TBFinCode],
  	[TBFinDate],
  	[TBFinType]
  from
  	[$(FromILRDatabase)].[$(FromILRSchema)].[TrailblazerApprenticeshipFinancialRecordDenorm] TrailblazerApprenticeshipFinancialRecord
  where
  	[TrailblazerApprenticeshipFinancialRecord].[UKPRN]=$(UKPRN)
  go
  
  insert into
  	[Valid].[LearnerFAM]
  		(
  			[LearnerFAM_Id],
  			[LearnFAMCode],
  			[LearnFAMType]
  		)
  select
  	[LearnerFAM_Id],
  	[LearnFAMCode],
  	[LearnFAMType]
  from
  	[$(FromILRDatabase)].[$(FromILRSchema)].[LearnerFAMDenorm] LearnerFAM
  where
  	[LearnerFAM].[UKPRN]=$(UKPRN)
  go
  
  insert into
  	[Valid].[LearnerEmploymentStatus]
  		(
  			[LearnerEmploymentStatus_Id],
  			[DateEmpStatApp],
  			[EmpId],
  			[EmpStat]
  		)
  select
  	[LearnerEmploymentStatus_Id],
  	[DateEmpStatApp],
  	[EmpId],
  	[EmpStat]
  from
  	[$(FromILRDatabase)].[$(FromILRSchema)].[LearnerEmploymentStatusDenorm] LearnerEmploymentStatus
  where
  	[LearnerEmploymentStatus].[UKPRN]=$(UKPRN)
  go
  
  insert into
  	[Valid].[EmploymentStatusMonitoring]
  		(
  			[EmploymentStatusMonitoring_Id],
  			[ESMCode],
  			[ESMType]
  		)
  select
  	[EmploymentStatusMonitoring_Id],
  	[ESMCode],
  	[ESMType]
  from
  	[$(FromILRDatabase)].[$(FromILRSchema)].[EmploymentStatusMonitoringDenorm] EmploymentStatusMonitoring
  where
  	[EmploymentStatusMonitoring].[UKPRN]=$(UKPRN)
  go
  
  insert into
  	[Valid].[LearnerContact]
  		(
  			[LearnerContact_Id],
  			[ContType],
  			[LocType],
  			[PostCode]
  		)
  select
  	[LearnerContact_Id],
  	[ContType],
  	[LocType],
  	[PostCode]
  from
  	[$(FromILRDatabase)].[$(FromILRSchema)].[LearnerContactDenorm] LearnerContact
  where
  	[LearnerContact].[UKPRN]=$(UKPRN)
  go
  
  insert into
  	[Valid].[PostAdd]
  		(
  			[PostAdd_Id],
  			[AddLine1]
  		)
  select
  	[PostAdd_Id],
  	[AddLine1]
  from
  	[$(FromILRDatabase)].[$(FromILRSchema)].[PostAddDenorm] PostAdd
  where
  	[PostAdd].[UKPRN]=$(UKPRN)
  go
  
  insert into
  	[Valid].[ContactPreference]
  		(
  			[ContactPreference_Id],
  			[ContPrefCode],
  			[ContPrefType]
  		)
  select
  	[ContactPreference_Id],
  	[ContPrefCode],
  	[ContPrefType]
  from
  	[$(FromILRDatabase)].[$(FromILRSchema)].[ContactPreferenceDenorm] ContactPreference
  where
  	[ContactPreference].[UKPRN]=$(UKPRN)
  go
  
  insert into
  	[Valid].[LLDDandHealthProblem]
  		(
  			[LLDDandHealthProblem_Id],
  			[LLDDCat],
  			[PrimaryLLDD]
  		)
  select
  	[LLDDandHealthProblem_Id],
  	[LLDDCat],
  	[PrimaryLLDD]
  from
  	[$(FromILRDatabase)].[$(FromILRSchema)].[LLDDandHealthProblemDenorm] LLDDandHealthProblem
  where
  	[LLDDandHealthProblem].[UKPRN]=$(UKPRN)
  go
  
  insert into
  	[Valid].[LearnerHE]
  		(
  			[LearnerHE_Id],
  			[TTACCOM],
  			[UCASPERID]
  		)
  select
  	[LearnerHE_Id],
  	[TTACCOM],
  	[UCASPERID]
  from
  	[$(FromILRDatabase)].[$(FromILRSchema)].[LearnerHEDenorm] LearnerHE
  where
  	[LearnerHE].[UKPRN]=$(UKPRN)
  go
  
  insert into
  	[Valid].[LearnerHEFinancialSupport]
  		(
  			[LearnerHEFinancialSupport_Id],
  			[FINTYPE]
  		)
  select
  	[LearnerHEFinancialSupport_Id],
  	[FINTYPE]
  from
  	[$(FromILRDatabase)].[$(FromILRSchema)].[LearnerHEFinancialSupportDenorm] LearnerHEFinancialSupport
  where
  	[LearnerHEFinancialSupport].[UKPRN]=$(UKPRN)
  go
  
  insert into
  	[Valid].[ProviderSpecLearnerMonitoring]
  		(
  			[ProviderSpecLearnerMonitoring_Id],
  			[ProvSpecLearnMonOccur]
  		)
  select
  	[ProviderSpecLearnerMonitoring_Id],
  	[ProvSpecLearnMonOccur]
  from
  	[$(FromILRDatabase)].[$(FromILRSchema)].[ProviderSpecLearnerMonitoringDenorm] ProviderSpecLearnerMonitoring
  where
  	[ProviderSpecLearnerMonitoring].[UKPRN]=$(UKPRN)
  go
  
  insert into
  	[Valid].[LearnerDestinationandProgression]
  		(
  			[LearnerDestinationandProgression_Id],
  			[LearnRefNumber],
  			[ULN]
  		)
  select
  	[LearnerDestinationandProgression_Id],
  	[LearnRefNumber],
  	[ULN]
  from
  	[$(FromILRDatabase)].[$(FromILRSchema)].[LearnerDestinationandProgressionDenorm] LearnerDestinationandProgression
  where
  	[LearnerDestinationandProgression].[UKPRN]=$(UKPRN)
  go
  
  insert into
  	[Valid].[DPOutcome]
  		(
  			[DPOutcome_Id],
  			[OutCode],
  			[OutStartDate],
  			[OutType]
  		)
  select
  	[DPOutcome_Id],
  	[OutCode],
  	[OutStartDate],
  	[OutType]
  from
  	[$(FromILRDatabase)].[$(FromILRSchema)].[DPOutcomeDenorm] DPOutcome
  where
  	[DPOutcome].[UKPRN]=$(UKPRN)
  go
  
  