April 18, 2018 at 6:32 am
Hi all
I've got a real brain-buster on my hands.....
First, some background.
We do an incremental load of various tables from a 3rd-party database that uses electronic documents and stores the data all over the place.
We put all the data together into a table that's named the same as the electronic document.
We initially load the new data into staging tables and then use MERGE statements to INSERT/UPDATE anything we already know about.
The tables look like this:-
Working table (for new data):-
CREATE TABLE [dbo].[wtbl_MT_EMR_Document_Tto_Medications_GENMT](
[DocumentID] [VARCHAR](30) NULL,
[EditedByStaffID] [VARCHAR](25) NULL,
[EditedDateTime] [DATETIME] NULL,
[AccountNumber] [VARCHAR](12) NULL,
[PatientLocalID] [VARCHAR](10) NULL,
[CreatedByStaffID] [VARCHAR](25) NULL,
[CreatedDateTime] [DATETIME] NULL,
[DocumentStatus] [VARCHAR](15) NULL,
[PatientDetails_PatientDetails] [VARCHAR](MAX) NULL,
[Heightweight_Height] [REAL] NULL,
[Heightweight_Height_Comment] [VARCHAR](MAX) NULL,
[Heightweight_Weight] [REAL] NULL,
[Heightweight_Weight_Comment] [VARCHAR](MAX) NULL,
[Heightweight_BodyMassIndexbmi] [VARCHAR](MAX) NULL,
[Aki_Aki] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_MedicationStartedAndReason] [VARCHAR](3) NULL,
[medicationStartedAndReason_Name_1] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_1] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_1] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_1] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_2] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_NoOfDaysToDispense_1] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_1] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_1] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_2] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_2] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_2] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_2] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_3] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_NoOfDaysToDispense_2] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_2] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_3] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_4] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_3] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_3] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_3] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_4] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_NoOfDaysToDispense_3] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_3] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_5] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_6] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_4] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_4] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_4] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_5] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_NoOfDaysToDispense_4] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_4] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_7] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_8] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_5] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_5] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_5] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_6] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_NoOfDaysToDispense_5] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_5] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_9] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_10] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_6] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_6] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_6] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_7] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_NoOfDaysToDispense_6] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_6] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_11] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_12] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_7] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_7] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_7] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_8] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_NoOfDaysToDispense_7] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_7] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_13] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_14] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_8] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_8] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_8] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_9] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_NoOfDaysToDispense_8] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_8] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_15] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_16] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_9] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_9] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_9] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_10] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_NoOfDaysToDispense_9] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_9] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_17] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_18] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_10] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_10] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_10] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_11] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_10] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_19] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_20] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_11] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_11] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_11] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_12] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_13] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_11] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_21] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_12] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_12] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_12] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_14] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_15] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_12] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_22] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_13] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_13] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_13] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_16] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_17] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_13] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_23] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_14] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_14] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_14] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_18] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_19] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_14] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_24] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_15] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_15] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_15] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_20] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_21] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_15] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_25] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_AdditionalMedicationsStarted] [VARCHAR](MAX) NULL,
[CdStarted_ControlledDrugs] [VARCHAR](MAX) NULL,
[CdStarted_CdName_1] [VARCHAR](MAX) NULL,
[CdStarted_Form_1] [VARCHAR](MAX) NULL,
[CdStarted_Dose_1] [VARCHAR](MAX) NULL,
[CdStarted_Frequency_1] [VARCHAR](MAX) NULL,
[CdStarted_Route_1] [VARCHAR](MAX) NULL,
[CdStarted_TotalQuantityfiguresWords_1] [VARCHAR](MAX) NULL,
[CdStarted_ReasonStarted_1] [VARCHAR](MAX) NULL,
[CdStarted_Date_1] [DATE] NULL,
[CdStarted_CdName_2] [VARCHAR](MAX) NULL,
[CdStarted_Form_2] [VARCHAR](MAX) NULL,
[CdStarted_Dose_2] [VARCHAR](MAX) NULL,
[CdStarted_Frequency_2] [VARCHAR](MAX) NULL,
[CdStarted_Route_2] [VARCHAR](MAX) NULL,
[CdStarted_TotalQuantityfiguresWords_2] [VARCHAR](MAX) NULL,
[CdStarted_ReasonStarted_2] [VARCHAR](MAX) NULL,
[CdStarted_Date_2] [DATE] NULL,
[CdStarted_CdName_3] [VARCHAR](MAX) NULL,
[CdStarted_Form_3] [VARCHAR](MAX) NULL,
[CdStarted_Dose_3] [VARCHAR](MAX) NULL,
[CdStarted_Frequency_3] [VARCHAR](MAX) NULL,
[CdStarted_Route_3] [VARCHAR](MAX) NULL,
[CdStarted_TotalQuantityfiguresWords_3] [VARCHAR](MAX) NULL,
[CdStarted_ReasonStarted_3] [VARCHAR](MAX) NULL,
[CdStarted_Date_3] [DATE] NULL,
[CdStarted_AdditonalControlledDrugsStarted] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DoseChangedToContinuedMedsAndReason] [VARCHAR](3) NULL,
[doseChangeToContinuedMedAndReason_Name_1] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_1] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_1] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_1] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_1] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_1] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_2] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_2] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_2] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_2] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_2] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_2] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_3] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_3] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_3] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_3] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_3] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_3] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_4] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_4] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_4] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_4] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_4] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_4] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_5] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_5] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_5] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_5] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_5] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_5] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_6] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_6] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_6] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_6] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_6] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_6] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_7] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_7] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_7] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_7] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_7] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_7] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_8] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_8] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_8] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_8] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_8] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_8] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_9] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_9] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_9] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_9] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_9] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_9] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_10] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_10] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_10] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_10] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_10] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_10] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_11] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_11] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_11] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_11] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_11] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_11] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_12] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_12] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_12] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_12] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_12] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_12] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_13] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_13] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_13] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_13] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_13] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_13] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_14] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_14] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_14] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_14] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_14] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_14] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_15] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_15] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_15] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_15] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_15] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_15] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_AdditonalMedicationsDoseChanged] [VARCHAR](MAX) NULL,
[CdDoseChanged_ControlledDrugs] [VARCHAR](MAX) NULL,
[CdDoseChanged_CdName_1] [VARCHAR](MAX) NULL,
[CdDoseChanged_Form_1] [VARCHAR](MAX) NULL,
[CdDoseChanged_Form_2] [VARCHAR](MAX) NULL,
[CdDoseChanged_Dose_1] [VARCHAR](MAX) NULL,
[CdDoseChanged_Frequency_1] [VARCHAR](MAX) NULL,
[CdDoseChanged_Frequency_2] [VARCHAR](MAX) NULL,
[CdDoseChanged_Route_1] [VARCHAR](MAX) NULL,
[CdDoseChanged_TotalQuantityfiguresWords_1] [VARCHAR](MAX) NULL,
[CdDoseChanged_TotalQuantityfiguresWords_2] [VARCHAR](MAX) NULL,
[CdDoseChanged_ReasonForChange_1] [VARCHAR](MAX) NULL,
[CdDoseChanged_Date_1] [DATE] NULL,
[CdDoseChanged_CdName_2] [VARCHAR](MAX) NULL,
[CdDoseChanged_Form_3] [VARCHAR](MAX) NULL,
[CdDoseChanged_Dose_2] [VARCHAR](MAX) NULL,
[CdDoseChanged_Frequency_3] [VARCHAR](MAX) NULL,
[CdDoseChanged_Route_2] [VARCHAR](MAX) NULL,
[CdDoseChanged_TotalQuantityfiguresWords_3] [VARCHAR](MAX) NULL,
[CdDoseChanged_ReasonForChange_2] [VARCHAR](MAX) NULL,
[CdDoseChanged_Date_2] [DATE] NULL,
[CdDoseChanged_CdName_3] [VARCHAR](MAX) NULL,
[CdDoseChanged_Form_4] [VARCHAR](MAX) NULL,
[CdDoseChanged_Dose_3] [VARCHAR](MAX) NULL,
[CdDoseChanged_Frequency_4] [VARCHAR](MAX) NULL,
[CdDoseChanged_Route_3] [VARCHAR](MAX) NULL,
[CdDoseChanged_TotalQuantityfiguresWords_4] [VARCHAR](MAX) NULL,
[CdDoseChanged_ReasonForChange_3] [VARCHAR](MAX) NULL,
[CdDoseChanged_Date_3] [DATE] NULL,
[CdDoseChanged_AdditonalControlledDrugsDoseChanged] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_MedicationContinuedUnchanged] [VARCHAR](3) NULL,
[medicationContinuedUnchanged_Name_1] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_1] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_1] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_1] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_1] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_2] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_2] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_2] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_2] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_2] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_3] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_3] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_3] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_3] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_3] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_4] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_4] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_4] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_4] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_4] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_5] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_5] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_5] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_5] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_5] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_6] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_6] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_6] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_6] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_6] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_7] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_7] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_7] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_7] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_7] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_8] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_8] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_8] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_8] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_8] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_9] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_9] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_9] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_9] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_9] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_10] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_10] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_10] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_10] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_10] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_11] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_11] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_11] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_11] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_11] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_12] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_12] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_12] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_12] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_12] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_13] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_13] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_13] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_13] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_13] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_14] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_14] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_14] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_14] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_14] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_15] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_15] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_15] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_15] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_15] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_16] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_16] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_16] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_16] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_16] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_17] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_17] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_17] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_17] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_17] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_18] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_18] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_18] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_18] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_18] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_19] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_19] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_19] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_19] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_19] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_20] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_20] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_20] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_20] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_20] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_21] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_21] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_21] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_21] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_21] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_22] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_22] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_22] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_22] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_22] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_23] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_23] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_23] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_23] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_23] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_24] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_24] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_24] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_24] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_24] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_25] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_25] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_25] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_25] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_25] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_26] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_26] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_26] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_26] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_26] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_27] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_27] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_27] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_27] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_27] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_28] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_28] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_28] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_28] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_28] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_29] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_29] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_29] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_29] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_29] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_30] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_30] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_30] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_30] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_30] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_AdditionalMedicationsContinuedUnchanged] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_ControlledDrugs] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_CdName_1] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_CdName_2] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Form_1] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Form_2] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Form_3] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Dose_1] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Dose_2] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Dose_3] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Frequency_1] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Frequency_2] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Route_1] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Route_2] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_TotalQuantityfiguresWords_1] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_TotalQuantityfiguresWords_2] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_ReasonToContinue_1] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_ReasonToContinue_2] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Date_1] [DATE] NULL,
[CdContinuedUnchanged_Date_2] [DATE] NULL,
[CdContinuedUnchanged_CdName_3] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Form_4] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Form_5] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Dose_4] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Dose_5] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Frequency_3] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Route_3] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_TotalQuantityfiguresWords_3] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_ReasonToContinue_3] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Date_3] [DATE] NULL,
[CdContinuedUnchanged_CdName_4] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Form_6] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Form_7] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Dose_6] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Dose_7] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Frequency_4] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Route_4] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_TotalQuantityfiguresWords_4] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_ReasonToContinue_4] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Date_4] [DATE] NULL,
[CdContinuedUnchanged_AdditionalControlledDrugsUnchanged] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_MedicationStoppedAndReason] [VARCHAR](3) NULL,
[medicationStoppedAndReason_Name_1] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_1] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_2] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_2] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_3] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_3] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_4] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_4] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_5] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_5] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_6] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_6] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_7] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_7] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_8] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_8] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_9] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_9] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_10] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_10] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_11] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_11] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_12] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_12] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_13] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_13] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_14] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_14] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_15] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_15] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_AdditionalMedicationsStopped] [VARCHAR](MAX) NULL,
[CdStopped_ControlledDrugs] [VARCHAR](MAX) NULL,
[CdStopped_CdName_1] [VARCHAR](MAX) NULL,
[CdStopped_CdName_2] [VARCHAR](MAX) NULL,
[CdStopped_Form_1] [VARCHAR](MAX) NULL,
[CdStopped_Dose_1] [VARCHAR](MAX) NULL,
[CdStopped_Frequency_1] [VARCHAR](MAX) NULL,
[CdStopped_Route_1] [VARCHAR](MAX) NULL,
[CdStopped_TotalQuantityfiguresWords_1] [VARCHAR](MAX) NULL,
[CdStopped_ReasonStopped_1] [VARCHAR](MAX) NULL,
[CdStopped_ReasonStopped_2] [VARCHAR](MAX) NULL,
[CdStopped_Date_1] [DATE] NULL,
[CdStopped_CdName_3] [VARCHAR](MAX) NULL,
[CdStopped_Form_2] [VARCHAR](MAX) NULL,
[CdStopped_Dose_2] [VARCHAR](MAX) NULL,
[CdStopped_Frequency_2] [VARCHAR](MAX) NULL,
[CdStopped_Route_2] [VARCHAR](MAX) NULL,
[CdStopped_TotalQuantityfiguresWords_2] [VARCHAR](MAX) NULL,
[CdStopped_ReasonStopped_3] [VARCHAR](MAX) NULL,
[CdStopped_Date_2] [DATE] NULL,
[CdStopped_CdName_4] [VARCHAR](MAX) NULL,
[CdStopped_Form_3] [VARCHAR](MAX) NULL,
[CdStopped_Dose_3] [VARCHAR](MAX) NULL,
[CdStopped_Frequency_3] [VARCHAR](MAX) NULL,
[CdStopped_Route_3] [VARCHAR](MAX) NULL,
[CdStopped_TotalQuantityfiguresWords_3] [VARCHAR](MAX) NULL,
[CdStopped_ReasonStopped_4] [VARCHAR](MAX) NULL,
[CdStopped_Date_3] [DATE] NULL,
[CdStopped_Name11] [VARCHAR](MAX) NULL,
[CdStopped_Reason11] [VARCHAR](MAX) NULL,
[CdStopped_Name12] [VARCHAR](MAX) NULL,
[CdStopped_Reason12] [VARCHAR](MAX) NULL,
[CdStopped_Name13] [VARCHAR](MAX) NULL,
[CdStopped_Reason13] [VARCHAR](MAX) NULL,
[CdStopped_Name14] [VARCHAR](MAX) NULL,
[CdStopped_Reason14] [VARCHAR](MAX) NULL,
[CdStopped_Name15] [VARCHAR](MAX) NULL,
[CdStopped_Reason15] [VARCHAR](MAX) NULL,
[CdStopped_AdditionalControlledDrugsStopped] [VARCHAR](MAX) NULL,
[prescriberDetails_PrescriberDetails] [VARCHAR](MAX) NULL,
[prescriberDetails_PrescriberContactNumber] [VARCHAR](MAX) NULL,
[IsDeleted] [BIT] NOT NULL,
[SYSDateLastUpdated] [DATETIME] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
Actual table (that holds data for all time):-
CREATE TABLE [dbo].[tbl_MT_EMR_Document_Tto_Medications_GENMT](
[pkDocumentID] [VARCHAR](30) NOT NULL,
[pkEditedByStaffID] [VARCHAR](25) NOT NULL,
[pkEditedDateTime] [DATETIME] NOT NULL,
[fkAccountNumber] [VARCHAR](12) NOT NULL,
[fkPatientLocalID] [VARCHAR](10) NULL,
[fkCreatedByStaffID] [VARCHAR](25) NULL,
[CreatedDateTime] [DATETIME] NULL,
[DocumentStatus] [VARCHAR](15) NULL,
[PatientDetails_PatientDetails] [VARCHAR](MAX) NULL,
[Heightweight_Height] [REAL] NULL,
[Heightweight_Height_Comment] [VARCHAR](MAX) NULL,
[Heightweight_Weight] [REAL] NULL,
[Heightweight_Weight_Comment] [VARCHAR](MAX) NULL,
[Heightweight_BodyMassIndexbmi] [VARCHAR](MAX) NULL,
[Aki_Aki] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_MedicationStartedAndReason] [VARCHAR](3) NULL,
[medicationStartedAndReason_Name_1] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_1] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_1] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_1] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_2] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_NoOfDaysToDispense_1] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_1] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_1] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_2] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_2] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_2] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_2] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_3] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_NoOfDaysToDispense_2] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_2] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_3] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_4] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_3] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_3] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_3] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_4] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_NoOfDaysToDispense_3] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_3] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_5] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_6] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_4] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_4] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_4] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_5] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_NoOfDaysToDispense_4] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_4] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_7] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_8] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_5] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_5] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_5] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_6] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_NoOfDaysToDispense_5] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_5] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_9] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_10] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_6] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_6] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_6] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_7] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_NoOfDaysToDispense_6] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_6] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_11] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_12] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_7] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_7] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_7] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_8] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_NoOfDaysToDispense_7] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_7] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_13] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_14] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_8] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_8] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_8] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_9] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_NoOfDaysToDispense_8] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_8] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_15] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_16] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_9] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_9] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_9] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_10] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_NoOfDaysToDispense_9] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_9] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_17] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_18] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_10] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_10] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_10] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_11] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_10] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_19] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_20] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_11] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_11] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_11] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_12] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_13] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_11] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_21] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_12] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_12] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_12] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_14] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_15] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_12] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_22] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_13] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_13] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_13] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_16] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_17] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_13] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_23] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_14] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_14] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_14] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_18] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_19] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_14] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_24] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Name_15] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Dose_15] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Frequency_15] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_20] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_Route_21] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_DaysToDispense_15] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_ReasonStarted_25] [VARCHAR](MAX) NULL,
[medicationStartedAndReason_AdditionalMedicationsStarted] [VARCHAR](MAX) NULL,
[CdStarted_ControlledDrugs] [VARCHAR](MAX) NULL,
[CdStarted_CdName_1] [VARCHAR](MAX) NULL,
[CdStarted_Form_1] [VARCHAR](MAX) NULL,
[CdStarted_Dose_1] [VARCHAR](MAX) NULL,
[CdStarted_Frequency_1] [VARCHAR](MAX) NULL,
[CdStarted_Route_1] [VARCHAR](MAX) NULL,
[CdStarted_TotalQuantityfiguresWords_1] [VARCHAR](MAX) NULL,
[CdStarted_ReasonStarted_1] [VARCHAR](MAX) NULL,
[CdStarted_Date_1] [DATE] NULL,
[CdStarted_CdName_2] [VARCHAR](MAX) NULL,
[CdStarted_Form_2] [VARCHAR](MAX) NULL,
[CdStarted_Dose_2] [VARCHAR](MAX) NULL,
[CdStarted_Frequency_2] [VARCHAR](MAX) NULL,
[CdStarted_Route_2] [VARCHAR](MAX) NULL,
[CdStarted_TotalQuantityfiguresWords_2] [VARCHAR](MAX) NULL,
[CdStarted_ReasonStarted_2] [VARCHAR](MAX) NULL,
[CdStarted_Date_2] [DATE] NULL,
[CdStarted_CdName_3] [VARCHAR](MAX) NULL,
[CdStarted_Form_3] [VARCHAR](MAX) NULL,
[CdStarted_Dose_3] [VARCHAR](MAX) NULL,
[CdStarted_Frequency_3] [VARCHAR](MAX) NULL,
[CdStarted_Route_3] [VARCHAR](MAX) NULL,
[CdStarted_TotalQuantityfiguresWords_3] [VARCHAR](MAX) NULL,
[CdStarted_ReasonStarted_3] [VARCHAR](MAX) NULL,
[CdStarted_Date_3] [DATE] NULL,
[CdStarted_AdditonalControlledDrugsStarted] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DoseChangedToContinuedMedsAndReason] [VARCHAR](3) NULL,
[doseChangeToContinuedMedAndReason_Name_1] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_1] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_1] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_1] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_1] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_1] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_2] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_2] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_2] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_2] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_2] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_2] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_3] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_3] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_3] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_3] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_3] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_3] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_4] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_4] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_4] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_4] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_4] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_4] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_5] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_5] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_5] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_5] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_5] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_5] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_6] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_6] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_6] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_6] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_6] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_6] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_7] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_7] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_7] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_7] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_7] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_7] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_8] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_8] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_8] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_8] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_8] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_8] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_9] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_9] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_9] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_9] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_9] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_9] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_10] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_10] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_10] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_10] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_10] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_10] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_11] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_11] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_11] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_11] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_11] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_11] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_12] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_12] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_12] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_12] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_12] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_12] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_13] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_13] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_13] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_13] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_13] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_13] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_14] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_14] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_14] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_14] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_14] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_14] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Name_15] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Dose_15] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Frequency_15] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_Route_15] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_DaysToDispense_15] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_ReasonChanged_15] [VARCHAR](MAX) NULL,
[doseChangeToContinuedMedAndReason_AdditonalMedicationsDoseChanged] [VARCHAR](MAX) NULL,
[CdDoseChanged_ControlledDrugs] [VARCHAR](MAX) NULL,
[CdDoseChanged_CdName_1] [VARCHAR](MAX) NULL,
[CdDoseChanged_Form_1] [VARCHAR](MAX) NULL,
[CdDoseChanged_Form_2] [VARCHAR](MAX) NULL,
[CdDoseChanged_Dose_1] [VARCHAR](MAX) NULL,
[CdDoseChanged_Frequency_1] [VARCHAR](MAX) NULL,
[CdDoseChanged_Frequency_2] [VARCHAR](MAX) NULL,
[CdDoseChanged_Route_1] [VARCHAR](MAX) NULL,
[CdDoseChanged_TotalQuantityfiguresWords_1] [VARCHAR](MAX) NULL,
[CdDoseChanged_TotalQuantityfiguresWords_2] [VARCHAR](MAX) NULL,
[CdDoseChanged_ReasonForChange_1] [VARCHAR](MAX) NULL,
[CdDoseChanged_Date_1] [DATE] NULL,
[CdDoseChanged_CdName_2] [VARCHAR](MAX) NULL,
[CdDoseChanged_Form_3] [VARCHAR](MAX) NULL,
[CdDoseChanged_Dose_2] [VARCHAR](MAX) NULL,
[CdDoseChanged_Frequency_3] [VARCHAR](MAX) NULL,
[CdDoseChanged_Route_2] [VARCHAR](MAX) NULL,
[CdDoseChanged_TotalQuantityfiguresWords_3] [VARCHAR](MAX) NULL,
[CdDoseChanged_ReasonForChange_2] [VARCHAR](MAX) NULL,
[CdDoseChanged_Date_2] [DATE] NULL,
[CdDoseChanged_CdName_3] [VARCHAR](MAX) NULL,
[CdDoseChanged_Form_4] [VARCHAR](MAX) NULL,
[CdDoseChanged_Dose_3] [VARCHAR](MAX) NULL,
[CdDoseChanged_Frequency_4] [VARCHAR](MAX) NULL,
[CdDoseChanged_Route_3] [VARCHAR](MAX) NULL,
[CdDoseChanged_TotalQuantityfiguresWords_4] [VARCHAR](MAX) NULL,
[CdDoseChanged_ReasonForChange_3] [VARCHAR](MAX) NULL,
[CdDoseChanged_Date_3] [DATE] NULL,
[CdDoseChanged_AdditonalControlledDrugsDoseChanged] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_MedicationContinuedUnchanged] [VARCHAR](3) NULL,
[medicationContinuedUnchanged_Name_1] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_1] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_1] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_1] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_1] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_2] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_2] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_2] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_2] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_2] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_3] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_3] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_3] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_3] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_3] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_4] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_4] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_4] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_4] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_4] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_5] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_5] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_5] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_5] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_5] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_6] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_6] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_6] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_6] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_6] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_7] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_7] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_7] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_7] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_7] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_8] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_8] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_8] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_8] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_8] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_9] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_9] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_9] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_9] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_9] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_10] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_10] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_10] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_10] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_10] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_11] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_11] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_11] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_11] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_11] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_12] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_12] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_12] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_12] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_12] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_13] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_13] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_13] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_13] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_13] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_14] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_14] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_14] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_14] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_14] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_15] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_15] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_15] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_15] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_15] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_16] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_16] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_16] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_16] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_16] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_17] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_17] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_17] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_17] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_17] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_18] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_18] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_18] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_18] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_18] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_19] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_19] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_19] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_19] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_19] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_20] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_20] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_20] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_20] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_20] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_21] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_21] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_21] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_21] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_21] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_22] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_22] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_22] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_22] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_22] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_23] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_23] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_23] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_23] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_23] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_24] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_24] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_24] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_24] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_24] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_25] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_25] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_25] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_25] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_25] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_26] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_26] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_26] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_26] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_26] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_27] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_27] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_27] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_27] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_27] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_28] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_28] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_28] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_28] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_28] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_29] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_29] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_29] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_29] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_29] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Name_30] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Dose_30] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Frequency_30] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_Route_30] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_DaysToDispense_30] [VARCHAR](MAX) NULL,
[medicationContinuedUnchanged_AdditionalMedicationsContinuedUnchanged] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_ControlledDrugs] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_CdName_1] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_CdName_2] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Form_1] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Form_2] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Form_3] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Dose_1] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Dose_2] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Dose_3] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Frequency_1] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Frequency_2] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Route_1] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Route_2] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_TotalQuantityfiguresWords_1] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_TotalQuantityfiguresWords_2] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_ReasonToContinue_1] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_ReasonToContinue_2] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Date_1] [DATE] NULL,
[CdContinuedUnchanged_Date_2] [DATE] NULL,
[CdContinuedUnchanged_CdName_3] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Form_4] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Form_5] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Dose_4] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Dose_5] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Frequency_3] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Route_3] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_TotalQuantityfiguresWords_3] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_ReasonToContinue_3] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Date_3] [DATE] NULL,
[CdContinuedUnchanged_CdName_4] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Form_6] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Form_7] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Dose_6] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Dose_7] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Frequency_4] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Route_4] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_TotalQuantityfiguresWords_4] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_ReasonToContinue_4] [VARCHAR](MAX) NULL,
[CdContinuedUnchanged_Date_4] [DATE] NULL,
[CdContinuedUnchanged_AdditionalControlledDrugsUnchanged] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_MedicationStoppedAndReason] [VARCHAR](3) NULL,
[medicationStoppedAndReason_Name_1] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_1] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_2] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_2] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_3] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_3] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_4] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_4] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_5] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_5] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_6] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_6] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_7] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_7] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_8] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_8] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_9] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_9] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_10] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_10] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_11] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_11] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_12] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_12] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_13] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_13] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_14] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_14] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_15] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_15] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_AdditionalMedicationsStopped] [VARCHAR](MAX) NULL,
[CdStopped_ControlledDrugs] [VARCHAR](MAX) NULL,
[CdStopped_CdName_1] [VARCHAR](MAX) NULL,
[CdStopped_CdName_2] [VARCHAR](MAX) NULL,
[CdStopped_Form_1] [VARCHAR](MAX) NULL,
[CdStopped_Dose_1] [VARCHAR](MAX) NULL,
[CdStopped_Frequency_1] [VARCHAR](MAX) NULL,
[CdStopped_Route_1] [VARCHAR](MAX) NULL,
[CdStopped_TotalQuantityfiguresWords_1] [VARCHAR](MAX) NULL,
[CdStopped_ReasonStopped_1] [VARCHAR](MAX) NULL,
[CdStopped_ReasonStopped_2] [VARCHAR](MAX) NULL,
[CdStopped_Date_1] [DATE] NULL,
[CdStopped_CdName_3] [VARCHAR](MAX) NULL,
[CdStopped_Form_2] [VARCHAR](MAX) NULL,
[CdStopped_Dose_2] [VARCHAR](MAX) NULL,
[CdStopped_Frequency_2] [VARCHAR](MAX) NULL,
[CdStopped_Route_2] [VARCHAR](MAX) NULL,
[CdStopped_TotalQuantityfiguresWords_2] [VARCHAR](MAX) NULL,
[CdStopped_ReasonStopped_3] [VARCHAR](MAX) NULL,
[CdStopped_Date_2] [DATE] NULL,
[CdStopped_CdName_4] [VARCHAR](MAX) NULL,
[CdStopped_Form_3] [VARCHAR](MAX) NULL,
[CdStopped_Dose_3] [VARCHAR](MAX) NULL,
[CdStopped_Frequency_3] [VARCHAR](MAX) NULL,
[CdStopped_Route_3] [VARCHAR](MAX) NULL,
[CdStopped_TotalQuantityfiguresWords_3] [VARCHAR](MAX) NULL,
[CdStopped_ReasonStopped_4] [VARCHAR](MAX) NULL,
[CdStopped_Date_3] [DATE] NULL,
[CdStopped_Name11] [VARCHAR](MAX) NULL,
[CdStopped_Reason11] [VARCHAR](MAX) NULL,
[CdStopped_Name12] [VARCHAR](MAX) NULL,
[CdStopped_Reason12] [VARCHAR](MAX) NULL,
[CdStopped_Name13] [VARCHAR](MAX) NULL,
[CdStopped_Reason13] [VARCHAR](MAX) NULL,
[CdStopped_Name14] [VARCHAR](MAX) NULL,
[CdStopped_Reason14] [VARCHAR](MAX) NULL,
[CdStopped_Name15] [VARCHAR](MAX) NULL,
[CdStopped_Reason15] [VARCHAR](MAX) NULL,
[CdStopped_AdditionalControlledDrugsStopped] [VARCHAR](MAX) NULL,
[prescriberDetails_PrescriberDetails] [VARCHAR](MAX) NULL,
[prescriberDetails_PrescriberContactNumber] [VARCHAR](MAX) NULL,
[IsDeleted] [BIT] NOT NULL,
[SYSDateLastUpdated] [DATETIME] NOT NULL,
[SYSDateLoaded] [DATETIME] NOT NULL,
PRIMARY KEY CLUSTERED
(
[pkDocumentID] ASC,
[pkEditedByStaffID] ASC,
[pkEditedDateTime] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[tbl_MT_EMR_Document_Tto_Medications_GENMT] ADD DEFAULT (GETDATE()) FOR [SYSDateLastUpdated]
GO
ALTER TABLE [dbo].[tbl_MT_EMR_Document_Tto_Medications_GENMT] ADD DEFAULT (GETDATE()) FOR [SYSDateLoaded]
GO
The tables are, for the most part, identical.
Now for the weird bit....
We can load the working table without an issue.
When we try to transfer the data from that to the actual table, we get the following error:-
Msg 511, Level 16, State 1, Line 1
Cannot create a row of size 9496 which is greater than the allowable maximum row size of 8060.
To me that's odd as it loads into the working table without an issue.
We get the same error using MERGE and INSERT.
Anyone any ideas?
April 18, 2018 at 7:21 am
Not replying directly to your question. But your table design on the face looks very suspect with the repeating groups of fields. This would normally result in a great number of NULL entries. Worse, if you ever needed more combinations than available, you'd have to alter the table. These should be broken out into child tables. Multiple child tables by the look of the column names.
The other possible red flag is the near complete use of VARCHAR(MAX). This may not be incorrect. The names indicate that they may be free form. But I would do this with great caution.
April 18, 2018 at 7:58 am
Unfortunately, that's how the document is designed on the system.
We've asked for repeating sections instead of being specifically number 1 to nnn and being a very wide table.
That way, we have a narrower table with repeating sections. So we go from (for example):-
[medicationStoppedAndReason_MedicationStoppedAndReason] [VARCHAR](3) NULL,
[medicationStoppedAndReason_Name_1] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_1] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_2] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_2] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_3] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_3] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_4] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_4] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_Name_5] [VARCHAR](MAX) NULL,
[medicationStoppedAndReason_ReasonStopped_5] [VARCHAR](MAX) NULL,
to:-
[Section (which would contain a number 1 to nnn)
[medicationStoppedAndReason_MedicationStoppedAndReason] [VARCHAR](3) NULL,
[medicationStoppedAndReason_Name] [VARCHAR](MAX) NULL,
It would make the table longer but narrower doing it this way.
As for field lengths, they are free text and also contain (in a lot of cases) a lot of formatting information for when the information is printed.
April 18, 2018 at 9:27 am
For that type of table definition, I'd suggest forcing all LOB columns completely out of the main table space (since SQL doesn't allow you to customize column-by-column). That should avoid any overly-large row size, I would think, although theoretically SQL should have pushed all of them out to LOB space if required anyway.
Specifically, issue this command on the table:
USE <db_name_containing_table>
EXEC sp_tableoption 'tbl_MT_EMR_Document_Tto_Medications_GENMT', 'large value types out of row'
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
April 18, 2018 at 9:42 am
Thanks Scott - I'll give that a go and see what happens when we next load the (currently) problem tables.
April 19, 2018 at 4:06 am
ScottPletcher - Wednesday, April 18, 2018 9:27 AMFor that type of table definition, I'd suggest forcing all LOB columns completely out of the main table space (since SQL doesn't allow you to customize column-by-column). That should avoid any overly-large row size, I would think, although theoretically SQL should have pushed all of them out to LOB space if required anyway.Specifically, issue this command on the table:
USE <db_name_containing_table>
EXEC sp_tableoption 'tbl_MT_EMR_Document_Tto_Medications_GENMT', 'large value types out of row'
Hi Scott
I ran that command against all of our tables (got a few error messages where the data types were inappropriate but I was expecting that).
Unfortunately, it didn't work and I'm still error messages along the lines of:-
Cannot create a row of size 8220 which is greater than the allowable maximum row size of 8060.
I ran the command and then ran our load. Did I need to restart the server/service before running the load (I assumed not)?
April 19, 2018 at 7:43 am
richardmgreen1 - Thursday, April 19, 2018 4:06 AMScottPletcher - Wednesday, April 18, 2018 9:27 AMFor that type of table definition, I'd suggest forcing all LOB columns completely out of the main table space (since SQL doesn't allow you to customize column-by-column). That should avoid any overly-large row size, I would think, although theoretically SQL should have pushed all of them out to LOB space if required anyway.Specifically, issue this command on the table:
USE <db_name_containing_table>
EXEC sp_tableoption 'tbl_MT_EMR_Document_Tto_Medications_GENMT', 'large value types out of row'Hi Scott
I ran that command against all of our tables (got a few error messages where the data types were inappropriate but I was expecting that).
Unfortunately, it didn't work and I'm still error messages along the lines of:-
Cannot create a row of size 8220 which is greater than the allowable maximum row size of 8060.I ran the command and then ran our load. Did I need to restart the server/service before running the load (I assumed not)?
No, don't need to restart.
Yes, that table is definitely too large. Every MAX pointer still takes 16 bytes. I have code that calcs roughly the max possible overhead bytes, and it returns this:
total_max_row_length data_length var_lengths bit_map general_row_overhead
9599 8465 1054 69 11
This might be overstated, if the 2-byte varchar length counter is in the overflow area when you force the overflow data there, but either way, it could be past 8060 bytes.
Basically you'll need to split this table into two tables, putting roughly half the column data into each one.
Btw, I wouldn't -- and didn't -- suggest running that code arbitrarily against all tables, it's not a generic solution.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
April 19, 2018 at 8:00 am
I'm aware you suggested running it against a single table, but this is on our development server (with backups) and we have a lot of tables with this issue.
It looks like we'll need to find another way of loading this data.
I'm still confused as to why it loads into our staging area without an issue but chokes when we move it to the "proper" table for reporting purposes.
April 19, 2018 at 8:08 am
richardmgreen1 - Thursday, April 19, 2018 8:00 AMI'm aware you suggested running it against a single table, but this is on our development server (with backups) and we have a lot of tables with this issue.It looks like we'll need to find another way of loading this data.
I'm still confused as to why it loads into our staging area without an issue but chokes when we move it to the "proper" table for reporting purposes.
How exactly are you moving the data? You mentioned you were doing a merge and doing insert/update are you modifying the data during that process?
April 19, 2018 at 8:09 am
richardmgreen1 - Wednesday, April 18, 2018 6:32 AMThe tables are, for the most part, identical.
I know it seems too obvious but I suspect that if you can identify where they are different, you'll have your answer.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 19, 2018 at 8:20 am
ZZartin - Thursday, April 19, 2018 8:08 AMrichardmgreen1 - Thursday, April 19, 2018 8:00 AMI'm aware you suggested running it against a single table, but this is on our development server (with backups) and we have a lot of tables with this issue.It looks like we'll need to find another way of loading this data.
I'm still confused as to why it loads into our staging area without an issue but chokes when we move it to the "proper" table for reporting purposes.
How exactly are you moving the data? You mentioned you were doing a merge and doing insert/update are you modifying the data during that process?
We've tried doing a MERGE as well as INSERT/UPDATE separately.
Both give the same error. There's no changes happening to the data at the point of the move.
Jeff Moden - Thursday, April 19, 2018 8:09 AMrichardmgreen1 - Wednesday, April 18, 2018 6:32 AMThe tables are, for the most part, identical.I know it seems too obvious but I suspect that if you can identify where they are different, you'll have your answer.
I've posted both table create statements in my OP (I think).
There's one extra field in the "actual" table (SYSDateLoaded) and, apart from that and a few minor field name changes to keep to our naming conventions (pk for Primary Key, fk for Foreign Key, etc) I can't see any differences.
Happy for a second (or even third) pair of eyes though.
April 19, 2018 at 8:25 am
richardmgreen1 - Thursday, April 19, 2018 8:20 AMZZartin - Thursday, April 19, 2018 8:08 AMrichardmgreen1 - Thursday, April 19, 2018 8:00 AMI'm aware you suggested running it against a single table, but this is on our development server (with backups) and we have a lot of tables with this issue.It looks like we'll need to find another way of loading this data.
I'm still confused as to why it loads into our staging area without an issue but chokes when we move it to the "proper" table for reporting purposes.
How exactly are you moving the data? You mentioned you were doing a merge and doing insert/update are you modifying the data during that process?
We've tried doing a MERGE as well as INSERT/UPDATE separately.
Both give the same error. There's no changes happening to the data at the point of the move.
That wasn't the question though. When you do the inserts is it an exact column copy insert? When you do the updates are you updating the columns in the target to exactly what they are in source and are all other columns in the target null?
April 19, 2018 at 8:46 am
richardmgreen1 - Thursday, April 19, 2018 8:20 AMZZartin - Thursday, April 19, 2018 8:08 AMrichardmgreen1 - Thursday, April 19, 2018 8:00 AMI'm aware you suggested running it against a single table, but this is on our development server (with backups) and we have a lot of tables with this issue.It looks like we'll need to find another way of loading this data.
I'm still confused as to why it loads into our staging area without an issue but chokes when we move it to the "proper" table for reporting purposes.
How exactly are you moving the data? You mentioned you were doing a merge and doing insert/update are you modifying the data during that process?
We've tried doing a MERGE as well as INSERT/UPDATE separately.
Both give the same error. There's no changes happening to the data at the point of the move.Jeff Moden - Thursday, April 19, 2018 8:09 AMrichardmgreen1 - Wednesday, April 18, 2018 6:32 AMThe tables are, for the most part, identical.I know it seems too obvious but I suspect that if you can identify where they are different, you'll have your answer.
I've posted both table create statements in my OP (I think).
There's one extra field in the "actual" table (SYSDateLoaded) and, apart from that and a few minor field name changes to keep to our naming conventions (pk for Primary Key, fk for Foreign Key, etc) I can't see any differences.Happy for a second (or even third) pair of eyes though.
Yes. I know you've posted the DDL for both tables. I just don't have the time to do a comparison. Just wanted to make sure that you did.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 19, 2018 at 8:51 am
Apologies, yes. We take the staging table data (i.e. the new/updated data) and do a blanket insert of that record into the actual table from the staging table assuming it doesn't exist.
If it does exist, we do an update to make the actual table record match the staging data record.
This is a copy of our MERGE statement:-CREATE PROCEDURE [dbo].[usp_Load_tbl_MT_EMR_Document_Tto_Medications_GENMT]
AS
BEGIN
MERGE tbl_MT_EMR_Document_Tto_Medications_GENMT AS TARGET
USING wtbl_MT_EMR_Document_Tto_Medications_GENMT AS SOURCE
ON TARGET.pkDocumentID = SOURCE.DocumentID
AND TARGET.pkEditedByStaffID = SOURCE.EditedByStaffID
AND TARGET.pkEditedDateTime = SOURCE.EditedDateTime
WHEN NOT MATCHED THEN
INSERT
(
pkDocumentID
,pkEditedByStaffID
,pkEditedDateTime
,fkAccountNumber
,fkPatientLocalID
,fkCreatedByStaffID
,CreatedDateTime
,DocumentStatus
,[PatientDetails_PatientDetails]
,[Heightweight_Height]
,[Heightweight_Height_Comment]
,[Heightweight_Weight]
,[Heightweight_Weight_Comment]
,[Heightweight_BodyMassIndexbmi]
,[Aki_Aki]
,[medicationStartedAndReason_MedicationStartedAndReason]
,[medicationStartedAndReason_Name_1]
,[medicationStartedAndReason_Dose_1]
,[medicationStartedAndReason_Frequency_1]
,[medicationStartedAndReason_Route_1]
,[medicationStartedAndReason_Route_2]
,[medicationStartedAndReason_NoOfDaysToDispense_1]
,[medicationStartedAndReason_DaysToDispense_1]
,[medicationStartedAndReason_ReasonStarted_1]
,[medicationStartedAndReason_ReasonStarted_2]
,[medicationStartedAndReason_Name_2]
,[medicationStartedAndReason_Dose_2]
,[medicationStartedAndReason_Frequency_2]
,[medicationStartedAndReason_Route_3]
,[medicationStartedAndReason_NoOfDaysToDispense_2]
,[medicationStartedAndReason_DaysToDispense_2]
,[medicationStartedAndReason_ReasonStarted_3]
,[medicationStartedAndReason_ReasonStarted_4]
,[medicationStartedAndReason_Name_3]
,[medicationStartedAndReason_Dose_3]
,[medicationStartedAndReason_Frequency_3]
,[medicationStartedAndReason_Route_4]
,[medicationStartedAndReason_NoOfDaysToDispense_3]
,[medicationStartedAndReason_DaysToDispense_3]
,[medicationStartedAndReason_ReasonStarted_5]
,[medicationStartedAndReason_ReasonStarted_6]
,[medicationStartedAndReason_Name_4]
,[medicationStartedAndReason_Dose_4]
,[medicationStartedAndReason_Frequency_4]
,[medicationStartedAndReason_Route_5]
,[medicationStartedAndReason_NoOfDaysToDispense_4]
,[medicationStartedAndReason_DaysToDispense_4]
,[medicationStartedAndReason_ReasonStarted_7]
,[medicationStartedAndReason_ReasonStarted_8]
,[medicationStartedAndReason_Name_5]
,[medicationStartedAndReason_Dose_5]
,[medicationStartedAndReason_Frequency_5]
,[medicationStartedAndReason_Route_6]
,[medicationStartedAndReason_NoOfDaysToDispense_5]
,[medicationStartedAndReason_DaysToDispense_5]
,[medicationStartedAndReason_ReasonStarted_9]
,[medicationStartedAndReason_ReasonStarted_10]
,[medicationStartedAndReason_Name_6]
,[medicationStartedAndReason_Dose_6]
,[medicationStartedAndReason_Frequency_6]
,[medicationStartedAndReason_Route_7]
,[medicationStartedAndReason_NoOfDaysToDispense_6]
,[medicationStartedAndReason_DaysToDispense_6]
,[medicationStartedAndReason_ReasonStarted_11]
,[medicationStartedAndReason_ReasonStarted_12]
,[medicationStartedAndReason_Name_7]
,[medicationStartedAndReason_Dose_7]
,[medicationStartedAndReason_Frequency_7]
,[medicationStartedAndReason_Route_8]
,[medicationStartedAndReason_NoOfDaysToDispense_7]
,[medicationStartedAndReason_DaysToDispense_7]
,[medicationStartedAndReason_ReasonStarted_13]
,[medicationStartedAndReason_ReasonStarted_14]
,[medicationStartedAndReason_Name_8]
,[medicationStartedAndReason_Dose_8]
,[medicationStartedAndReason_Frequency_8]
,[medicationStartedAndReason_Route_9]
,[medicationStartedAndReason_NoOfDaysToDispense_8]
,[medicationStartedAndReason_DaysToDispense_8]
,[medicationStartedAndReason_ReasonStarted_15]
,[medicationStartedAndReason_ReasonStarted_16]
,[medicationStartedAndReason_Name_9]
,[medicationStartedAndReason_Dose_9]
,[medicationStartedAndReason_Frequency_9]
,[medicationStartedAndReason_Route_10]
,[medicationStartedAndReason_NoOfDaysToDispense_9]
,[medicationStartedAndReason_DaysToDispense_9]
,[medicationStartedAndReason_ReasonStarted_17]
,[medicationStartedAndReason_ReasonStarted_18]
,[medicationStartedAndReason_Name_10]
,[medicationStartedAndReason_Dose_10]
,[medicationStartedAndReason_Frequency_10]
,[medicationStartedAndReason_Route_11]
,[medicationStartedAndReason_DaysToDispense_10]
,[medicationStartedAndReason_ReasonStarted_19]
,[medicationStartedAndReason_ReasonStarted_20]
,[medicationStartedAndReason_Name_11]
,[medicationStartedAndReason_Dose_11]
,[medicationStartedAndReason_Frequency_11]
,[medicationStartedAndReason_Route_12]
,[medicationStartedAndReason_Route_13]
,[medicationStartedAndReason_DaysToDispense_11]
,[medicationStartedAndReason_ReasonStarted_21]
,[medicationStartedAndReason_Name_12]
,[medicationStartedAndReason_Dose_12]
,[medicationStartedAndReason_Frequency_12]
,[medicationStartedAndReason_Route_14]
,[medicationStartedAndReason_Route_15]
,[medicationStartedAndReason_DaysToDispense_12]
,[medicationStartedAndReason_ReasonStarted_22]
,[medicationStartedAndReason_Name_13]
,[medicationStartedAndReason_Dose_13]
,[medicationStartedAndReason_Frequency_13]
,[medicationStartedAndReason_Route_16]
,[medicationStartedAndReason_Route_17]
,[medicationStartedAndReason_DaysToDispense_13]
,[medicationStartedAndReason_ReasonStarted_23]
,[medicationStartedAndReason_Name_14]
,[medicationStartedAndReason_Dose_14]
,[medicationStartedAndReason_Frequency_14]
,[medicationStartedAndReason_Route_18]
,[medicationStartedAndReason_Route_19]
,[medicationStartedAndReason_DaysToDispense_14]
,[medicationStartedAndReason_ReasonStarted_24]
,[medicationStartedAndReason_Name_15]
,[medicationStartedAndReason_Dose_15]
,[medicationStartedAndReason_Frequency_15]
,[medicationStartedAndReason_Route_20]
,[medicationStartedAndReason_Route_21]
,[medicationStartedAndReason_DaysToDispense_15]
,[medicationStartedAndReason_ReasonStarted_25]
,[medicationStartedAndReason_AdditionalMedicationsStarted]
,[CdStarted_ControlledDrugs]
,[CdStarted_CdName_1]
,[CdStarted_Form_1]
,[CdStarted_Dose_1]
,[CdStarted_Frequency_1]
,[CdStarted_Route_1]
,[CdStarted_TotalQuantityfiguresWords_1]
,[CdStarted_ReasonStarted_1]
,[CdStarted_Date_1]
,[CdStarted_CdName_2]
,[CdStarted_Form_2]
,[CdStarted_Dose_2]
,[CdStarted_Frequency_2]
,[CdStarted_Route_2]
,[CdStarted_TotalQuantityfiguresWords_2]
,[CdStarted_ReasonStarted_2]
,[CdStarted_Date_2]
,[CdStarted_CdName_3]
,[CdStarted_Form_3]
,[CdStarted_Dose_3]
,[CdStarted_Frequency_3]
,[CdStarted_Route_3]
,[CdStarted_TotalQuantityfiguresWords_3]
,[CdStarted_ReasonStarted_3]
,[CdStarted_Date_3]
,[CdStarted_AdditonalControlledDrugsStarted]
,[doseChangeToContinuedMedAndReason_DoseChangedToContinuedMedsAndReason]
,[doseChangeToContinuedMedAndReason_Name_1]
,[doseChangeToContinuedMedAndReason_Dose_1]
,[doseChangeToContinuedMedAndReason_Frequency_1]
,[doseChangeToContinuedMedAndReason_Route_1]
,[doseChangeToContinuedMedAndReason_DaysToDispense_1]
,[doseChangeToContinuedMedAndReason_ReasonChanged_1]
,[doseChangeToContinuedMedAndReason_Name_2]
,[doseChangeToContinuedMedAndReason_Dose_2]
,[doseChangeToContinuedMedAndReason_Frequency_2]
,[doseChangeToContinuedMedAndReason_Route_2]
,[doseChangeToContinuedMedAndReason_DaysToDispense_2]
,[doseChangeToContinuedMedAndReason_ReasonChanged_2]
,[doseChangeToContinuedMedAndReason_Name_3]
,[doseChangeToContinuedMedAndReason_Dose_3]
,[doseChangeToContinuedMedAndReason_Frequency_3]
,[doseChangeToContinuedMedAndReason_Route_3]
,[doseChangeToContinuedMedAndReason_DaysToDispense_3]
,[doseChangeToContinuedMedAndReason_ReasonChanged_3]
,[doseChangeToContinuedMedAndReason_Name_4]
,[doseChangeToContinuedMedAndReason_Dose_4]
,[doseChangeToContinuedMedAndReason_Frequency_4]
,[doseChangeToContinuedMedAndReason_Route_4]
,[doseChangeToContinuedMedAndReason_DaysToDispense_4]
,[doseChangeToContinuedMedAndReason_ReasonChanged_4]
,[doseChangeToContinuedMedAndReason_Name_5]
,[doseChangeToContinuedMedAndReason_Dose_5]
,[doseChangeToContinuedMedAndReason_Frequency_5]
,[doseChangeToContinuedMedAndReason_Route_5]
,[doseChangeToContinuedMedAndReason_DaysToDispense_5]
,[doseChangeToContinuedMedAndReason_ReasonChanged_5]
,[doseChangeToContinuedMedAndReason_Name_6]
,[doseChangeToContinuedMedAndReason_Dose_6]
,[doseChangeToContinuedMedAndReason_Frequency_6]
,[doseChangeToContinuedMedAndReason_Route_6]
,[doseChangeToContinuedMedAndReason_DaysToDispense_6]
,[doseChangeToContinuedMedAndReason_ReasonChanged_6]
,[doseChangeToContinuedMedAndReason_Name_7]
,[doseChangeToContinuedMedAndReason_Dose_7]
,[doseChangeToContinuedMedAndReason_Frequency_7]
,[doseChangeToContinuedMedAndReason_Route_7]
,[doseChangeToContinuedMedAndReason_DaysToDispense_7]
,[doseChangeToContinuedMedAndReason_ReasonChanged_7]
,[doseChangeToContinuedMedAndReason_Name_8]
,[doseChangeToContinuedMedAndReason_Dose_8]
,[doseChangeToContinuedMedAndReason_Frequency_8]
,[doseChangeToContinuedMedAndReason_Route_8]
,[doseChangeToContinuedMedAndReason_DaysToDispense_8]
,[doseChangeToContinuedMedAndReason_ReasonChanged_8]
,[doseChangeToContinuedMedAndReason_Name_9]
,[doseChangeToContinuedMedAndReason_Dose_9]
,[doseChangeToContinuedMedAndReason_Frequency_9]
,[doseChangeToContinuedMedAndReason_Route_9]
,[doseChangeToContinuedMedAndReason_DaysToDispense_9]
,[doseChangeToContinuedMedAndReason_ReasonChanged_9]
,[doseChangeToContinuedMedAndReason_Name_10]
,[doseChangeToContinuedMedAndReason_Dose_10]
,[doseChangeToContinuedMedAndReason_Frequency_10]
,[doseChangeToContinuedMedAndReason_Route_10]
,[doseChangeToContinuedMedAndReason_DaysToDispense_10]
,[doseChangeToContinuedMedAndReason_ReasonChanged_10]
,[doseChangeToContinuedMedAndReason_Name_11]
,[doseChangeToContinuedMedAndReason_Dose_11]
,[doseChangeToContinuedMedAndReason_Frequency_11]
,[doseChangeToContinuedMedAndReason_Route_11]
,[doseChangeToContinuedMedAndReason_DaysToDispense_11]
,[doseChangeToContinuedMedAndReason_ReasonChanged_11]
,[doseChangeToContinuedMedAndReason_Name_12]
,[doseChangeToContinuedMedAndReason_Dose_12]
,[doseChangeToContinuedMedAndReason_Frequency_12]
,[doseChangeToContinuedMedAndReason_Route_12]
,[doseChangeToContinuedMedAndReason_DaysToDispense_12]
,[doseChangeToContinuedMedAndReason_ReasonChanged_12]
,[doseChangeToContinuedMedAndReason_Name_13]
,[doseChangeToContinuedMedAndReason_Dose_13]
,[doseChangeToContinuedMedAndReason_Frequency_13]
,[doseChangeToContinuedMedAndReason_Route_13]
,[doseChangeToContinuedMedAndReason_DaysToDispense_13]
,[doseChangeToContinuedMedAndReason_ReasonChanged_13]
,[doseChangeToContinuedMedAndReason_Name_14]
,[doseChangeToContinuedMedAndReason_Dose_14]
,[doseChangeToContinuedMedAndReason_Frequency_14]
,[doseChangeToContinuedMedAndReason_Route_14]
,[doseChangeToContinuedMedAndReason_DaysToDispense_14]
,[doseChangeToContinuedMedAndReason_ReasonChanged_14]
,[doseChangeToContinuedMedAndReason_Name_15]
,[doseChangeToContinuedMedAndReason_Dose_15]
,[doseChangeToContinuedMedAndReason_Frequency_15]
,[doseChangeToContinuedMedAndReason_Route_15]
,[doseChangeToContinuedMedAndReason_DaysToDispense_15]
,[doseChangeToContinuedMedAndReason_ReasonChanged_15]
,[doseChangeToContinuedMedAndReason_AdditonalMedicationsDoseChanged]
,[CdDoseChanged_ControlledDrugs]
,[CdDoseChanged_CdName_1]
,[CdDoseChanged_Form_1]
,[CdDoseChanged_Form_2]
,[CdDoseChanged_Dose_1]
,[CdDoseChanged_Frequency_1]
,[CdDoseChanged_Frequency_2]
,[CdDoseChanged_Route_1]
,[CdDoseChanged_TotalQuantityfiguresWords_1]
,[CdDoseChanged_TotalQuantityfiguresWords_2]
,[CdDoseChanged_ReasonForChange_1]
,[CdDoseChanged_Date_1]
,[CdDoseChanged_CdName_2]
,[CdDoseChanged_Form_3]
,[CdDoseChanged_Dose_2]
,[CdDoseChanged_Frequency_3]
,[CdDoseChanged_Route_2]
,[CdDoseChanged_TotalQuantityfiguresWords_3]
,[CdDoseChanged_ReasonForChange_2]
,[CdDoseChanged_Date_2]
,[CdDoseChanged_CdName_3]
,[CdDoseChanged_Form_4]
,[CdDoseChanged_Dose_3]
,[CdDoseChanged_Frequency_4]
,[CdDoseChanged_Route_3]
,[CdDoseChanged_TotalQuantityfiguresWords_4]
,[CdDoseChanged_ReasonForChange_3]
,[CdDoseChanged_Date_3]
,[CdDoseChanged_AdditonalControlledDrugsDoseChanged]
,[medicationContinuedUnchanged_MedicationContinuedUnchanged]
,[medicationContinuedUnchanged_Name_1]
,[medicationContinuedUnchanged_Dose_1]
,[medicationContinuedUnchanged_Frequency_1]
,[medicationContinuedUnchanged_Route_1]
,[medicationContinuedUnchanged_DaysToDispense_1]
,[medicationContinuedUnchanged_Name_2]
,[medicationContinuedUnchanged_Dose_2]
,[medicationContinuedUnchanged_Frequency_2]
,[medicationContinuedUnchanged_Route_2]
,[medicationContinuedUnchanged_DaysToDispense_2]
,[medicationContinuedUnchanged_Name_3]
,[medicationContinuedUnchanged_Dose_3]
,[medicationContinuedUnchanged_Frequency_3]
,[medicationContinuedUnchanged_Route_3]
,[medicationContinuedUnchanged_DaysToDispense_3]
,[medicationContinuedUnchanged_Name_4]
,[medicationContinuedUnchanged_Dose_4]
,[medicationContinuedUnchanged_Frequency_4]
,[medicationContinuedUnchanged_Route_4]
,[medicationContinuedUnchanged_DaysToDispense_4]
,[medicationContinuedUnchanged_Name_5]
,[medicationContinuedUnchanged_Dose_5]
,[medicationContinuedUnchanged_Frequency_5]
,[medicationContinuedUnchanged_Route_5]
,[medicationContinuedUnchanged_DaysToDispense_5]
,[medicationContinuedUnchanged_Name_6]
,[medicationContinuedUnchanged_Dose_6]
,[medicationContinuedUnchanged_Frequency_6]
,[medicationContinuedUnchanged_Route_6]
,[medicationContinuedUnchanged_DaysToDispense_6]
,[medicationContinuedUnchanged_Name_7]
,[medicationContinuedUnchanged_Dose_7]
,[medicationContinuedUnchanged_Frequency_7]
,[medicationContinuedUnchanged_Route_7]
,[medicationContinuedUnchanged_DaysToDispense_7]
,[medicationContinuedUnchanged_Name_8]
,[medicationContinuedUnchanged_Dose_8]
,[medicationContinuedUnchanged_Frequency_8]
,[medicationContinuedUnchanged_Route_8]
,[medicationContinuedUnchanged_DaysToDispense_8]
,[medicationContinuedUnchanged_Name_9]
,[medicationContinuedUnchanged_Dose_9]
,[medicationContinuedUnchanged_Frequency_9]
,[medicationContinuedUnchanged_Route_9]
,[medicationContinuedUnchanged_DaysToDispense_9]
,[medicationContinuedUnchanged_Name_10]
,[medicationContinuedUnchanged_Dose_10]
,[medicationContinuedUnchanged_Frequency_10]
,[medicationContinuedUnchanged_Route_10]
,[medicationContinuedUnchanged_DaysToDispense_10]
,[medicationContinuedUnchanged_Name_11]
,[medicationContinuedUnchanged_Dose_11]
,[medicationContinuedUnchanged_Frequency_11]
,[medicationContinuedUnchanged_Route_11]
,[medicationContinuedUnchanged_DaysToDispense_11]
,[medicationContinuedUnchanged_Name_12]
,[medicationContinuedUnchanged_Dose_12]
,[medicationContinuedUnchanged_Frequency_12]
,[medicationContinuedUnchanged_Route_12]
,[medicationContinuedUnchanged_DaysToDispense_12]
,[medicationContinuedUnchanged_Name_13]
,[medicationContinuedUnchanged_Dose_13]
,[medicationContinuedUnchanged_Frequency_13]
,[medicationContinuedUnchanged_Route_13]
,[medicationContinuedUnchanged_DaysToDispense_13]
,[medicationContinuedUnchanged_Name_14]
,[medicationContinuedUnchanged_Dose_14]
,[medicationContinuedUnchanged_Frequency_14]
,[medicationContinuedUnchanged_Route_14]
,[medicationContinuedUnchanged_DaysToDispense_14]
,[medicationContinuedUnchanged_Name_15]
,[medicationContinuedUnchanged_Dose_15]
,[medicationContinuedUnchanged_Frequency_15]
,[medicationContinuedUnchanged_Route_15]
,[medicationContinuedUnchanged_DaysToDispense_15]
,[medicationContinuedUnchanged_Name_16]
,[medicationContinuedUnchanged_Dose_16]
,[medicationContinuedUnchanged_Frequency_16]
,[medicationContinuedUnchanged_Route_16]
,[medicationContinuedUnchanged_DaysToDispense_16]
,[medicationContinuedUnchanged_Name_17]
,[medicationContinuedUnchanged_Dose_17]
,[medicationContinuedUnchanged_Frequency_17]
,[medicationContinuedUnchanged_Route_17]
,[medicationContinuedUnchanged_DaysToDispense_17]
,[medicationContinuedUnchanged_Name_18]
,[medicationContinuedUnchanged_Dose_18]
,[medicationContinuedUnchanged_Frequency_18]
,[medicationContinuedUnchanged_Route_18]
,[medicationContinuedUnchanged_DaysToDispense_18]
,[medicationContinuedUnchanged_Name_19]
,[medicationContinuedUnchanged_Dose_19]
,[medicationContinuedUnchanged_Frequency_19]
,[medicationContinuedUnchanged_Route_19]
,[medicationContinuedUnchanged_DaysToDispense_19]
,[medicationContinuedUnchanged_Name_20]
,[medicationContinuedUnchanged_Dose_20]
,[medicationContinuedUnchanged_Frequency_20]
,[medicationContinuedUnchanged_Route_20]
,[medicationContinuedUnchanged_DaysToDispense_20]
,[medicationContinuedUnchanged_Name_21]
,[medicationContinuedUnchanged_Dose_21]
,[medicationContinuedUnchanged_Frequency_21]
,[medicationContinuedUnchanged_Route_21]
,[medicationContinuedUnchanged_DaysToDispense_21]
,[medicationContinuedUnchanged_Name_22]
,[medicationContinuedUnchanged_Dose_22]
,[medicationContinuedUnchanged_Frequency_22]
,[medicationContinuedUnchanged_Route_22]
,[medicationContinuedUnchanged_DaysToDispense_22]
,[medicationContinuedUnchanged_Name_23]
,[medicationContinuedUnchanged_Dose_23]
,[medicationContinuedUnchanged_Frequency_23]
,[medicationContinuedUnchanged_Route_23]
,[medicationContinuedUnchanged_DaysToDispense_23]
,[medicationContinuedUnchanged_Name_24]
,[medicationContinuedUnchanged_Dose_24]
,[medicationContinuedUnchanged_Frequency_24]
,[medicationContinuedUnchanged_Route_24]
,[medicationContinuedUnchanged_DaysToDispense_24]
,[medicationContinuedUnchanged_Name_25]
,[medicationContinuedUnchanged_Dose_25]
,[medicationContinuedUnchanged_Frequency_25]
,[medicationContinuedUnchanged_Route_25]
,[medicationContinuedUnchanged_DaysToDispense_25]
,[medicationContinuedUnchanged_Name_26]
,[medicationContinuedUnchanged_Dose_26]
,[medicationContinuedUnchanged_Frequency_26]
,[medicationContinuedUnchanged_Route_26]
,[medicationContinuedUnchanged_DaysToDispense_26]
,[medicationContinuedUnchanged_Name_27]
,[medicationContinuedUnchanged_Dose_27]
,[medicationContinuedUnchanged_Frequency_27]
,[medicationContinuedUnchanged_Route_27]
,[medicationContinuedUnchanged_DaysToDispense_27]
,[medicationContinuedUnchanged_Name_28]
,[medicationContinuedUnchanged_Dose_28]
,[medicationContinuedUnchanged_Frequency_28]
,[medicationContinuedUnchanged_Route_28]
,[medicationContinuedUnchanged_DaysToDispense_28]
,[medicationContinuedUnchanged_Name_29]
,[medicationContinuedUnchanged_Dose_29]
,[medicationContinuedUnchanged_Frequency_29]
,[medicationContinuedUnchanged_Route_29]
,[medicationContinuedUnchanged_DaysToDispense_29]
,[medicationContinuedUnchanged_Name_30]
,[medicationContinuedUnchanged_Dose_30]
,[medicationContinuedUnchanged_Frequency_30]
,[medicationContinuedUnchanged_Route_30]
,[medicationContinuedUnchanged_DaysToDispense_30]
,[medicationContinuedUnchanged_AdditionalMedicationsContinuedUnchanged]
,[CdContinuedUnchanged_ControlledDrugs]
,[CdContinuedUnchanged_CdName_1]
,[CdContinuedUnchanged_CdName_2]
,[CdContinuedUnchanged_Form_1]
,[CdContinuedUnchanged_Form_2]
,[CdContinuedUnchanged_Form_3]
,[CdContinuedUnchanged_Dose_1]
,[CdContinuedUnchanged_Dose_2]
,[CdContinuedUnchanged_Dose_3]
,[CdContinuedUnchanged_Frequency_1]
,[CdContinuedUnchanged_Frequency_2]
,[CdContinuedUnchanged_Route_1]
,[CdContinuedUnchanged_Route_2]
,[CdContinuedUnchanged_TotalQuantityfiguresWords_1]
,[CdContinuedUnchanged_TotalQuantityfiguresWords_2]
,[CdContinuedUnchanged_ReasonToContinue_1]
,[CdContinuedUnchanged_ReasonToContinue_2]
,[CdContinuedUnchanged_Date_1]
,[CdContinuedUnchanged_Date_2]
,[CdContinuedUnchanged_CdName_3]
,[CdContinuedUnchanged_Form_4]
,[CdContinuedUnchanged_Form_5]
,[CdContinuedUnchanged_Dose_4]
,[CdContinuedUnchanged_Dose_5]
,[CdContinuedUnchanged_Frequency_3]
,[CdContinuedUnchanged_Route_3]
,[CdContinuedUnchanged_TotalQuantityfiguresWords_3]
,[CdContinuedUnchanged_ReasonToContinue_3]
,[CdContinuedUnchanged_Date_3]
,[CdContinuedUnchanged_CdName_4]
,[CdContinuedUnchanged_Form_6]
,[CdContinuedUnchanged_Form_7]
,[CdContinuedUnchanged_Dose_6]
,[CdContinuedUnchanged_Dose_7]
,[CdContinuedUnchanged_Frequency_4]
,[CdContinuedUnchanged_Route_4]
,[CdContinuedUnchanged_TotalQuantityfiguresWords_4]
,[CdContinuedUnchanged_ReasonToContinue_4]
,[CdContinuedUnchanged_Date_4]
,[CdContinuedUnchanged_AdditionalControlledDrugsUnchanged]
,[medicationStoppedAndReason_MedicationStoppedAndReason]
,[medicationStoppedAndReason_Name_1]
,[medicationStoppedAndReason_ReasonStopped_1]
,[medicationStoppedAndReason_Name_2]
,[medicationStoppedAndReason_ReasonStopped_2]
,[medicationStoppedAndReason_Name_3]
,[medicationStoppedAndReason_ReasonStopped_3]
,[medicationStoppedAndReason_Name_4]
,[medicationStoppedAndReason_ReasonStopped_4]
,[medicationStoppedAndReason_Name_5]
,[medicationStoppedAndReason_ReasonStopped_5]
,[medicationStoppedAndReason_Name_6]
,[medicationStoppedAndReason_ReasonStopped_6]
,[medicationStoppedAndReason_Name_7]
,[medicationStoppedAndReason_ReasonStopped_7]
,[medicationStoppedAndReason_Name_8]
,[medicationStoppedAndReason_ReasonStopped_8]
,[medicationStoppedAndReason_Name_9]
,[medicationStoppedAndReason_ReasonStopped_9]
,[medicationStoppedAndReason_Name_10]
,[medicationStoppedAndReason_ReasonStopped_10]
,[medicationStoppedAndReason_Name_11]
,[medicationStoppedAndReason_ReasonStopped_11]
,[medicationStoppedAndReason_Name_12]
,[medicationStoppedAndReason_ReasonStopped_12]
,[medicationStoppedAndReason_Name_13]
,[medicationStoppedAndReason_ReasonStopped_13]
,[medicationStoppedAndReason_Name_14]
,[medicationStoppedAndReason_ReasonStopped_14]
,[medicationStoppedAndReason_Name_15]
,[medicationStoppedAndReason_ReasonStopped_15]
,[medicationStoppedAndReason_AdditionalMedicationsStopped]
,[CdStopped_ControlledDrugs]
,[CdStopped_CdName_1]
,[CdStopped_CdName_2]
,[CdStopped_Form_1]
,[CdStopped_Dose_1]
,[CdStopped_Frequency_1]
,[CdStopped_Route_1]
,[CdStopped_TotalQuantityfiguresWords_1]
,[CdStopped_ReasonStopped_1]
,[CdStopped_ReasonStopped_2]
,[CdStopped_Date_1]
,[CdStopped_CdName_3]
,[CdStopped_Form_2]
,[CdStopped_Dose_2]
,[CdStopped_Frequency_2]
,[CdStopped_Route_2]
,[CdStopped_TotalQuantityfiguresWords_2]
,[CdStopped_ReasonStopped_3]
,[CdStopped_Date_2]
,[CdStopped_CdName_4]
,[CdStopped_Form_3]
,[CdStopped_Dose_3]
,[CdStopped_Frequency_3]
,[CdStopped_Route_3]
,[CdStopped_TotalQuantityfiguresWords_3]
,[CdStopped_ReasonStopped_4]
,[CdStopped_Date_3]
,[CdStopped_Name11]
,[CdStopped_Reason11]
,[CdStopped_Name12]
,[CdStopped_Reason12]
,[CdStopped_Name13]
,[CdStopped_Reason13]
,[CdStopped_Name14]
,[CdStopped_Reason14]
,[CdStopped_Name15]
,[CdStopped_Reason15]
,[CdStopped_AdditionalControlledDrugsStopped]
,[prescriberDetails_PrescriberDetails]
,[prescriberDetails_PrescriberContactNumber]
,IsDeleted
)
VALUES
(
SOURCE.DocumentID
,SOURCE.EditedByStaffID
,SOURCE.EditedDateTime
,SOURCE.AccountNumber
,SOURCE.PatientLocalID
,SOURCE.CreatedByStaffID
,SOURCE.CreatedDateTime
,SOURCE.DocumentStatus
,SOURCE.[PatientDetails_PatientDetails]
,SOURCE.[Heightweight_Height]
,SOURCE.[Heightweight_Height_Comment]
,SOURCE.[Heightweight_Weight]
,SOURCE.[Heightweight_Weight_Comment]
,SOURCE.[Heightweight_BodyMassIndexbmi]
,SOURCE.[Aki_Aki]
,SOURCE.[medicationStartedAndReason_MedicationStartedAndReason]
,SOURCE.[medicationStartedAndReason_Name_1]
,SOURCE.[medicationStartedAndReason_Dose_1]
,SOURCE.[medicationStartedAndReason_Frequency_1]
,SOURCE.[medicationStartedAndReason_Route_1]
,SOURCE.[medicationStartedAndReason_Route_2]
,SOURCE.[medicationStartedAndReason_NoOfDaysToDispense_1]
,SOURCE.[medicationStartedAndReason_DaysToDispense_1]
,SOURCE.[medicationStartedAndReason_ReasonStarted_1]
,SOURCE.[medicationStartedAndReason_ReasonStarted_2]
,SOURCE.[medicationStartedAndReason_Name_2]
,SOURCE.[medicationStartedAndReason_Dose_2]
,SOURCE.[medicationStartedAndReason_Frequency_2]
,SOURCE.[medicationStartedAndReason_Route_3]
,SOURCE.[medicationStartedAndReason_NoOfDaysToDispense_2]
,SOURCE.[medicationStartedAndReason_DaysToDispense_2]
,SOURCE.[medicationStartedAndReason_ReasonStarted_3]
,SOURCE.[medicationStartedAndReason_ReasonStarted_4]
,SOURCE.[medicationStartedAndReason_Name_3]
,SOURCE.[medicationStartedAndReason_Dose_3]
,SOURCE.[medicationStartedAndReason_Frequency_3]
,SOURCE.[medicationStartedAndReason_Route_4]
,SOURCE.[medicationStartedAndReason_NoOfDaysToDispense_3]
,SOURCE.[medicationStartedAndReason_DaysToDispense_3]
,SOURCE.[medicationStartedAndReason_ReasonStarted_5]
,SOURCE.[medicationStartedAndReason_ReasonStarted_6]
,SOURCE.[medicationStartedAndReason_Name_4]
,SOURCE.[medicationStartedAndReason_Dose_4]
,SOURCE.[medicationStartedAndReason_Frequency_4]
,SOURCE.[medicationStartedAndReason_Route_5]
,SOURCE.[medicationStartedAndReason_NoOfDaysToDispense_4]
,SOURCE.[medicationStartedAndReason_DaysToDispense_4]
,SOURCE.[medicationStartedAndReason_ReasonStarted_7]
,SOURCE.[medicationStartedAndReason_ReasonStarted_8]
,SOURCE.[medicationStartedAndReason_Name_5]
,SOURCE.[medicationStartedAndReason_Dose_5]
,SOURCE.[medicationStartedAndReason_Frequency_5]
,SOURCE.[medicationStartedAndReason_Route_6]
,SOURCE.[medicationStartedAndReason_NoOfDaysToDispense_5]
,SOURCE.[medicationStartedAndReason_DaysToDispense_5]
,SOURCE.[medicationStartedAndReason_ReasonStarted_9]
,SOURCE.[medicationStartedAndReason_ReasonStarted_10]
,SOURCE.[medicationStartedAndReason_Name_6]
,SOURCE.[medicationStartedAndReason_Dose_6]
,SOURCE.[medicationStartedAndReason_Frequency_6]
,SOURCE.[medicationStartedAndReason_Route_7]
,SOURCE.[medicationStartedAndReason_NoOfDaysToDispense_6]
,SOURCE.[medicationStartedAndReason_DaysToDispense_6]
,SOURCE.[medicationStartedAndReason_ReasonStarted_11]
,SOURCE.[medicationStartedAndReason_ReasonStarted_12]
,SOURCE.[medicationStartedAndReason_Name_7]
,SOURCE.[medicationStartedAndReason_Dose_7]
,SOURCE.[medicationStartedAndReason_Frequency_7]
,SOURCE.[medicationStartedAndReason_Route_8]
,SOURCE.[medicationStartedAndReason_NoOfDaysToDispense_7]
,SOURCE.[medicationStartedAndReason_DaysToDispense_7]
,SOURCE.[medicationStartedAndReason_ReasonStarted_13]
,SOURCE.[medicationStartedAndReason_ReasonStarted_14]
,SOURCE.[medicationStartedAndReason_Name_8]
,SOURCE.[medicationStartedAndReason_Dose_8]
,SOURCE.[medicationStartedAndReason_Frequency_8]
,SOURCE.[medicationStartedAndReason_Route_9]
,SOURCE.[medicationStartedAndReason_NoOfDaysToDispense_8]
,SOURCE.[medicationStartedAndReason_DaysToDispense_8]
,SOURCE.[medicationStartedAndReason_ReasonStarted_15]
,SOURCE.[medicationStartedAndReason_ReasonStarted_16]
,SOURCE.[medicationStartedAndReason_Name_9]
,SOURCE.[medicationStartedAndReason_Dose_9]
,SOURCE.[medicationStartedAndReason_Frequency_9]
,SOURCE.[medicationStartedAndReason_Route_10]
,SOURCE.[medicationStartedAndReason_NoOfDaysToDispense_9]
,SOURCE.[medicationStartedAndReason_DaysToDispense_9]
,SOURCE.[medicationStartedAndReason_ReasonStarted_17]
,SOURCE.[medicationStartedAndReason_ReasonStarted_18]
,SOURCE.[medicationStartedAndReason_Name_10]
,SOURCE.[medicationStartedAndReason_Dose_10]
,SOURCE.[medicationStartedAndReason_Frequency_10]
,SOURCE.[medicationStartedAndReason_Route_11]
,SOURCE.[medicationStartedAndReason_DaysToDispense_10]
,SOURCE.[medicationStartedAndReason_ReasonStarted_19]
,SOURCE.[medicationStartedAndReason_ReasonStarted_20]
,SOURCE.[medicationStartedAndReason_Name_11]
,SOURCE.[medicationStartedAndReason_Dose_11]
,SOURCE.[medicationStartedAndReason_Frequency_11]
,SOURCE.[medicationStartedAndReason_Route_12]
,SOURCE.[medicationStartedAndReason_Route_13]
,SOURCE.[medicationStartedAndReason_DaysToDispense_11]
,SOURCE.[medicationStartedAndReason_ReasonStarted_21]
,SOURCE.[medicationStartedAndReason_Name_12]
,SOURCE.[medicationStartedAndReason_Dose_12]
,SOURCE.[medicationStartedAndReason_Frequency_12]
,SOURCE.[medicationStartedAndReason_Route_14]
,SOURCE.[medicationStartedAndReason_Route_15]
,SOURCE.[medicationStartedAndReason_DaysToDispense_12]
,SOURCE.[medicationStartedAndReason_ReasonStarted_22]
,SOURCE.[medicationStartedAndReason_Name_13]
,SOURCE.[medicationStartedAndReason_Dose_13]
,SOURCE.[medicationStartedAndReason_Frequency_13]
,SOURCE.[medicationStartedAndReason_Route_16]
,SOURCE.[medicationStartedAndReason_Route_17]
,SOURCE.[medicationStartedAndReason_DaysToDispense_13]
,SOURCE.[medicationStartedAndReason_ReasonStarted_23]
,SOURCE.[medicationStartedAndReason_Name_14]
,SOURCE.[medicationStartedAndReason_Dose_14]
,SOURCE.[medicationStartedAndReason_Frequency_14]
,SOURCE.[medicationStartedAndReason_Route_18]
,SOURCE.[medicationStartedAndReason_Route_19]
,SOURCE.[medicationStartedAndReason_DaysToDispense_14]
,SOURCE.[medicationStartedAndReason_ReasonStarted_24]
,SOURCE.[medicationStartedAndReason_Name_15]
,SOURCE.[medicationStartedAndReason_Dose_15]
,SOURCE.[medicationStartedAndReason_Frequency_15]
,SOURCE.[medicationStartedAndReason_Route_20]
,SOURCE.[medicationStartedAndReason_Route_21]
,SOURCE.[medicationStartedAndReason_DaysToDispense_15]
,SOURCE.[medicationStartedAndReason_ReasonStarted_25]
,SOURCE.[medicationStartedAndReason_AdditionalMedicationsStarted]
,SOURCE.[CdStarted_ControlledDrugs]
,SOURCE.[CdStarted_CdName_1]
,SOURCE.[CdStarted_Form_1]
,SOURCE.[CdStarted_Dose_1]
,SOURCE.[CdStarted_Frequency_1]
,SOURCE.[CdStarted_Route_1]
,SOURCE.[CdStarted_TotalQuantityfiguresWords_1]
,SOURCE.[CdStarted_ReasonStarted_1]
,SOURCE.[CdStarted_Date_1]
,SOURCE.[CdStarted_CdName_2]
,SOURCE.[CdStarted_Form_2]
,SOURCE.[CdStarted_Dose_2]
,SOURCE.[CdStarted_Frequency_2]
,SOURCE.[CdStarted_Route_2]
,SOURCE.[CdStarted_TotalQuantityfiguresWords_2]
,SOURCE.[CdStarted_ReasonStarted_2]
,SOURCE.[CdStarted_Date_2]
,SOURCE.[CdStarted_CdName_3]
,SOURCE.[CdStarted_Form_3]
,SOURCE.[CdStarted_Dose_3]
,SOURCE.[CdStarted_Frequency_3]
,SOURCE.[CdStarted_Route_3]
,SOURCE.[CdStarted_TotalQuantityfiguresWords_3]
,SOURCE.[CdStarted_ReasonStarted_3]
,SOURCE.[CdStarted_Date_3]
,SOURCE.[CdStarted_AdditonalControlledDrugsStarted]
,SOURCE.[doseChangeToContinuedMedAndReason_DoseChangedToContinuedMedsAndReason]
,SOURCE.[doseChangeToContinuedMedAndReason_Name_1]
,SOURCE.[doseChangeToContinuedMedAndReason_Dose_1]
,SOURCE.[doseChangeToContinuedMedAndReason_Frequency_1]
,SOURCE.[doseChangeToContinuedMedAndReason_Route_1]
,SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_1]
,SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_1]
,SOURCE.[doseChangeToContinuedMedAndReason_Name_2]
,SOURCE.[doseChangeToContinuedMedAndReason_Dose_2]
,SOURCE.[doseChangeToContinuedMedAndReason_Frequency_2]
,SOURCE.[doseChangeToContinuedMedAndReason_Route_2]
,SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_2]
,SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_2]
,SOURCE.[doseChangeToContinuedMedAndReason_Name_3]
,SOURCE.[doseChangeToContinuedMedAndReason_Dose_3]
,SOURCE.[doseChangeToContinuedMedAndReason_Frequency_3]
,SOURCE.[doseChangeToContinuedMedAndReason_Route_3]
,SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_3]
,SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_3]
,SOURCE.[doseChangeToContinuedMedAndReason_Name_4]
,SOURCE.[doseChangeToContinuedMedAndReason_Dose_4]
,SOURCE.[doseChangeToContinuedMedAndReason_Frequency_4]
,SOURCE.[doseChangeToContinuedMedAndReason_Route_4]
,SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_4]
,SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_4]
,SOURCE.[doseChangeToContinuedMedAndReason_Name_5]
,SOURCE.[doseChangeToContinuedMedAndReason_Dose_5]
,SOURCE.[doseChangeToContinuedMedAndReason_Frequency_5]
,SOURCE.[doseChangeToContinuedMedAndReason_Route_5]
,SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_5]
,SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_5]
,SOURCE.[doseChangeToContinuedMedAndReason_Name_6]
,SOURCE.[doseChangeToContinuedMedAndReason_Dose_6]
,SOURCE.[doseChangeToContinuedMedAndReason_Frequency_6]
,SOURCE.[doseChangeToContinuedMedAndReason_Route_6]
,SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_6]
,SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_6]
,SOURCE.[doseChangeToContinuedMedAndReason_Name_7]
,SOURCE.[doseChangeToContinuedMedAndReason_Dose_7]
,SOURCE.[doseChangeToContinuedMedAndReason_Frequency_7]
,SOURCE.[doseChangeToContinuedMedAndReason_Route_7]
,SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_7]
,SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_7]
,SOURCE.[doseChangeToContinuedMedAndReason_Name_8]
,SOURCE.[doseChangeToContinuedMedAndReason_Dose_8]
,SOURCE.[doseChangeToContinuedMedAndReason_Frequency_8]
,SOURCE.[doseChangeToContinuedMedAndReason_Route_8]
,SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_8]
,SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_8]
,SOURCE.[doseChangeToContinuedMedAndReason_Name_9]
,SOURCE.[doseChangeToContinuedMedAndReason_Dose_9]
,SOURCE.[doseChangeToContinuedMedAndReason_Frequency_9]
,SOURCE.[doseChangeToContinuedMedAndReason_Route_9]
,SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_9]
,SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_9]
,SOURCE.[doseChangeToContinuedMedAndReason_Name_10]
,SOURCE.[doseChangeToContinuedMedAndReason_Dose_10]
,SOURCE.[doseChangeToContinuedMedAndReason_Frequency_10]
,SOURCE.[doseChangeToContinuedMedAndReason_Route_10]
,SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_10]
,SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_10]
,SOURCE.[doseChangeToContinuedMedAndReason_Name_11]
,SOURCE.[doseChangeToContinuedMedAndReason_Dose_11]
,SOURCE.[doseChangeToContinuedMedAndReason_Frequency_11]
,SOURCE.[doseChangeToContinuedMedAndReason_Route_11]
,SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_11]
,SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_11]
,SOURCE.[doseChangeToContinuedMedAndReason_Name_12]
,SOURCE.[doseChangeToContinuedMedAndReason_Dose_12]
,SOURCE.[doseChangeToContinuedMedAndReason_Frequency_12]
,SOURCE.[doseChangeToContinuedMedAndReason_Route_12]
,SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_12]
,SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_12]
,SOURCE.[doseChangeToContinuedMedAndReason_Name_13]
,SOURCE.[doseChangeToContinuedMedAndReason_Dose_13]
,SOURCE.[doseChangeToContinuedMedAndReason_Frequency_13]
,SOURCE.[doseChangeToContinuedMedAndReason_Route_13]
,SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_13]
,SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_13]
,SOURCE.[doseChangeToContinuedMedAndReason_Name_14]
,SOURCE.[doseChangeToContinuedMedAndReason_Dose_14]
,SOURCE.[doseChangeToContinuedMedAndReason_Frequency_14]
,SOURCE.[doseChangeToContinuedMedAndReason_Route_14]
,SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_14]
,SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_14]
,SOURCE.[doseChangeToContinuedMedAndReason_Name_15]
,SOURCE.[doseChangeToContinuedMedAndReason_Dose_15]
,SOURCE.[doseChangeToContinuedMedAndReason_Frequency_15]
,SOURCE.[doseChangeToContinuedMedAndReason_Route_15]
,SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_15]
,SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_15]
,SOURCE.[doseChangeToContinuedMedAndReason_AdditonalMedicationsDoseChanged]
,SOURCE.[CdDoseChanged_ControlledDrugs]
,SOURCE.[CdDoseChanged_CdName_1]
,SOURCE.[CdDoseChanged_Form_1]
,SOURCE.[CdDoseChanged_Form_2]
,SOURCE.[CdDoseChanged_Dose_1]
,SOURCE.[CdDoseChanged_Frequency_1]
,SOURCE.[CdDoseChanged_Frequency_2]
,SOURCE.[CdDoseChanged_Route_1]
,SOURCE.[CdDoseChanged_TotalQuantityfiguresWords_1]
,SOURCE.[CdDoseChanged_TotalQuantityfiguresWords_2]
,SOURCE.[CdDoseChanged_ReasonForChange_1]
,SOURCE.[CdDoseChanged_Date_1]
,SOURCE.[CdDoseChanged_CdName_2]
,SOURCE.[CdDoseChanged_Form_3]
,SOURCE.[CdDoseChanged_Dose_2]
,SOURCE.[CdDoseChanged_Frequency_3]
,SOURCE.[CdDoseChanged_Route_2]
,SOURCE.[CdDoseChanged_TotalQuantityfiguresWords_3]
,SOURCE.[CdDoseChanged_ReasonForChange_2]
,SOURCE.[CdDoseChanged_Date_2]
,SOURCE.[CdDoseChanged_CdName_3]
,SOURCE.[CdDoseChanged_Form_4]
,SOURCE.[CdDoseChanged_Dose_3]
,SOURCE.[CdDoseChanged_Frequency_4]
,SOURCE.[CdDoseChanged_Route_3]
,SOURCE.[CdDoseChanged_TotalQuantityfiguresWords_4]
,SOURCE.[CdDoseChanged_ReasonForChange_3]
,SOURCE.[CdDoseChanged_Date_3]
,SOURCE.[CdDoseChanged_AdditonalControlledDrugsDoseChanged]
,SOURCE.[medicationContinuedUnchanged_MedicationContinuedUnchanged]
,SOURCE.[medicationContinuedUnchanged_Name_1]
,SOURCE.[medicationContinuedUnchanged_Dose_1]
,SOURCE.[medicationContinuedUnchanged_Frequency_1]
,SOURCE.[medicationContinuedUnchanged_Route_1]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_1]
,SOURCE.[medicationContinuedUnchanged_Name_2]
,SOURCE.[medicationContinuedUnchanged_Dose_2]
,SOURCE.[medicationContinuedUnchanged_Frequency_2]
,SOURCE.[medicationContinuedUnchanged_Route_2]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_2]
,SOURCE.[medicationContinuedUnchanged_Name_3]
,SOURCE.[medicationContinuedUnchanged_Dose_3]
,SOURCE.[medicationContinuedUnchanged_Frequency_3]
,SOURCE.[medicationContinuedUnchanged_Route_3]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_3]
,SOURCE.[medicationContinuedUnchanged_Name_4]
,SOURCE.[medicationContinuedUnchanged_Dose_4]
,SOURCE.[medicationContinuedUnchanged_Frequency_4]
,SOURCE.[medicationContinuedUnchanged_Route_4]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_4]
,SOURCE.[medicationContinuedUnchanged_Name_5]
,SOURCE.[medicationContinuedUnchanged_Dose_5]
,SOURCE.[medicationContinuedUnchanged_Frequency_5]
,SOURCE.[medicationContinuedUnchanged_Route_5]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_5]
,SOURCE.[medicationContinuedUnchanged_Name_6]
,SOURCE.[medicationContinuedUnchanged_Dose_6]
,SOURCE.[medicationContinuedUnchanged_Frequency_6]
,SOURCE.[medicationContinuedUnchanged_Route_6]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_6]
,SOURCE.[medicationContinuedUnchanged_Name_7]
,SOURCE.[medicationContinuedUnchanged_Dose_7]
,SOURCE.[medicationContinuedUnchanged_Frequency_7]
,SOURCE.[medicationContinuedUnchanged_Route_7]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_7]
,SOURCE.[medicationContinuedUnchanged_Name_8]
,SOURCE.[medicationContinuedUnchanged_Dose_8]
,SOURCE.[medicationContinuedUnchanged_Frequency_8]
,SOURCE.[medicationContinuedUnchanged_Route_8]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_8]
,SOURCE.[medicationContinuedUnchanged_Name_9]
,SOURCE.[medicationContinuedUnchanged_Dose_9]
,SOURCE.[medicationContinuedUnchanged_Frequency_9]
,SOURCE.[medicationContinuedUnchanged_Route_9]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_9]
,SOURCE.[medicationContinuedUnchanged_Name_10]
,SOURCE.[medicationContinuedUnchanged_Dose_10]
,SOURCE.[medicationContinuedUnchanged_Frequency_10]
,SOURCE.[medicationContinuedUnchanged_Route_10]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_10]
,SOURCE.[medicationContinuedUnchanged_Name_11]
,SOURCE.[medicationContinuedUnchanged_Dose_11]
,SOURCE.[medicationContinuedUnchanged_Frequency_11]
,SOURCE.[medicationContinuedUnchanged_Route_11]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_11]
,SOURCE.[medicationContinuedUnchanged_Name_12]
,SOURCE.[medicationContinuedUnchanged_Dose_12]
,SOURCE.[medicationContinuedUnchanged_Frequency_12]
,SOURCE.[medicationContinuedUnchanged_Route_12]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_12]
,SOURCE.[medicationContinuedUnchanged_Name_13]
,SOURCE.[medicationContinuedUnchanged_Dose_13]
,SOURCE.[medicationContinuedUnchanged_Frequency_13]
,SOURCE.[medicationContinuedUnchanged_Route_13]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_13]
,SOURCE.[medicationContinuedUnchanged_Name_14]
,SOURCE.[medicationContinuedUnchanged_Dose_14]
,SOURCE.[medicationContinuedUnchanged_Frequency_14]
,SOURCE.[medicationContinuedUnchanged_Route_14]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_14]
,SOURCE.[medicationContinuedUnchanged_Name_15]
,SOURCE.[medicationContinuedUnchanged_Dose_15]
,SOURCE.[medicationContinuedUnchanged_Frequency_15]
,SOURCE.[medicationContinuedUnchanged_Route_15]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_15]
,SOURCE.[medicationContinuedUnchanged_Name_16]
,SOURCE.[medicationContinuedUnchanged_Dose_16]
,SOURCE.[medicationContinuedUnchanged_Frequency_16]
,SOURCE.[medicationContinuedUnchanged_Route_16]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_16]
,SOURCE.[medicationContinuedUnchanged_Name_17]
,SOURCE.[medicationContinuedUnchanged_Dose_17]
,SOURCE.[medicationContinuedUnchanged_Frequency_17]
,SOURCE.[medicationContinuedUnchanged_Route_17]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_17]
,SOURCE.[medicationContinuedUnchanged_Name_18]
,SOURCE.[medicationContinuedUnchanged_Dose_18]
,SOURCE.[medicationContinuedUnchanged_Frequency_18]
,SOURCE.[medicationContinuedUnchanged_Route_18]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_18]
,SOURCE.[medicationContinuedUnchanged_Name_19]
,SOURCE.[medicationContinuedUnchanged_Dose_19]
,SOURCE.[medicationContinuedUnchanged_Frequency_19]
,SOURCE.[medicationContinuedUnchanged_Route_19]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_19]
,SOURCE.[medicationContinuedUnchanged_Name_20]
,SOURCE.[medicationContinuedUnchanged_Dose_20]
,SOURCE.[medicationContinuedUnchanged_Frequency_20]
,SOURCE.[medicationContinuedUnchanged_Route_20]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_20]
,SOURCE.[medicationContinuedUnchanged_Name_21]
,SOURCE.[medicationContinuedUnchanged_Dose_21]
,SOURCE.[medicationContinuedUnchanged_Frequency_21]
,SOURCE.[medicationContinuedUnchanged_Route_21]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_21]
,SOURCE.[medicationContinuedUnchanged_Name_22]
,SOURCE.[medicationContinuedUnchanged_Dose_22]
,SOURCE.[medicationContinuedUnchanged_Frequency_22]
,SOURCE.[medicationContinuedUnchanged_Route_22]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_22]
,SOURCE.[medicationContinuedUnchanged_Name_23]
,SOURCE.[medicationContinuedUnchanged_Dose_23]
,SOURCE.[medicationContinuedUnchanged_Frequency_23]
,SOURCE.[medicationContinuedUnchanged_Route_23]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_23]
,SOURCE.[medicationContinuedUnchanged_Name_24]
,SOURCE.[medicationContinuedUnchanged_Dose_24]
,SOURCE.[medicationContinuedUnchanged_Frequency_24]
,SOURCE.[medicationContinuedUnchanged_Route_24]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_24]
,SOURCE.[medicationContinuedUnchanged_Name_25]
,SOURCE.[medicationContinuedUnchanged_Dose_25]
,SOURCE.[medicationContinuedUnchanged_Frequency_25]
,SOURCE.[medicationContinuedUnchanged_Route_25]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_25]
,SOURCE.[medicationContinuedUnchanged_Name_26]
,SOURCE.[medicationContinuedUnchanged_Dose_26]
,SOURCE.[medicationContinuedUnchanged_Frequency_26]
,SOURCE.[medicationContinuedUnchanged_Route_26]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_26]
,SOURCE.[medicationContinuedUnchanged_Name_27]
,SOURCE.[medicationContinuedUnchanged_Dose_27]
,SOURCE.[medicationContinuedUnchanged_Frequency_27]
,SOURCE.[medicationContinuedUnchanged_Route_27]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_27]
,SOURCE.[medicationContinuedUnchanged_Name_28]
,SOURCE.[medicationContinuedUnchanged_Dose_28]
,SOURCE.[medicationContinuedUnchanged_Frequency_28]
,SOURCE.[medicationContinuedUnchanged_Route_28]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_28]
,SOURCE.[medicationContinuedUnchanged_Name_29]
,SOURCE.[medicationContinuedUnchanged_Dose_29]
,SOURCE.[medicationContinuedUnchanged_Frequency_29]
,SOURCE.[medicationContinuedUnchanged_Route_29]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_29]
,SOURCE.[medicationContinuedUnchanged_Name_30]
,SOURCE.[medicationContinuedUnchanged_Dose_30]
,SOURCE.[medicationContinuedUnchanged_Frequency_30]
,SOURCE.[medicationContinuedUnchanged_Route_30]
,SOURCE.[medicationContinuedUnchanged_DaysToDispense_30]
,SOURCE.[medicationContinuedUnchanged_AdditionalMedicationsContinuedUnchanged]
,SOURCE.[CdContinuedUnchanged_ControlledDrugs]
,SOURCE.[CdContinuedUnchanged_CdName_1]
,SOURCE.[CdContinuedUnchanged_CdName_2]
,SOURCE.[CdContinuedUnchanged_Form_1]
,SOURCE.[CdContinuedUnchanged_Form_2]
,SOURCE.[CdContinuedUnchanged_Form_3]
,SOURCE.[CdContinuedUnchanged_Dose_1]
,SOURCE.[CdContinuedUnchanged_Dose_2]
,SOURCE.[CdContinuedUnchanged_Dose_3]
,SOURCE.[CdContinuedUnchanged_Frequency_1]
,SOURCE.[CdContinuedUnchanged_Frequency_2]
,SOURCE.[CdContinuedUnchanged_Route_1]
,SOURCE.[CdContinuedUnchanged_Route_2]
,SOURCE.[CdContinuedUnchanged_TotalQuantityfiguresWords_1]
,SOURCE.[CdContinuedUnchanged_TotalQuantityfiguresWords_2]
,SOURCE.[CdContinuedUnchanged_ReasonToContinue_1]
,SOURCE.[CdContinuedUnchanged_ReasonToContinue_2]
,SOURCE.[CdContinuedUnchanged_Date_1]
,SOURCE.[CdContinuedUnchanged_Date_2]
,SOURCE.[CdContinuedUnchanged_CdName_3]
,SOURCE.[CdContinuedUnchanged_Form_4]
,SOURCE.[CdContinuedUnchanged_Form_5]
,SOURCE.[CdContinuedUnchanged_Dose_4]
,SOURCE.[CdContinuedUnchanged_Dose_5]
,SOURCE.[CdContinuedUnchanged_Frequency_3]
,SOURCE.[CdContinuedUnchanged_Route_3]
,SOURCE.[CdContinuedUnchanged_TotalQuantityfiguresWords_3]
,SOURCE.[CdContinuedUnchanged_ReasonToContinue_3]
,SOURCE.[CdContinuedUnchanged_Date_3]
,SOURCE.[CdContinuedUnchanged_CdName_4]
,SOURCE.[CdContinuedUnchanged_Form_6]
,SOURCE.[CdContinuedUnchanged_Form_7]
,SOURCE.[CdContinuedUnchanged_Dose_6]
,SOURCE.[CdContinuedUnchanged_Dose_7]
,SOURCE.[CdContinuedUnchanged_Frequency_4]
,SOURCE.[CdContinuedUnchanged_Route_4]
,SOURCE.[CdContinuedUnchanged_TotalQuantityfiguresWords_4]
,SOURCE.[CdContinuedUnchanged_ReasonToContinue_4]
,SOURCE.[CdContinuedUnchanged_Date_4]
,SOURCE.[CdContinuedUnchanged_AdditionalControlledDrugsUnchanged]
,SOURCE.[medicationStoppedAndReason_MedicationStoppedAndReason]
,SOURCE.[medicationStoppedAndReason_Name_1]
,SOURCE.[medicationStoppedAndReason_ReasonStopped_1]
,SOURCE.[medicationStoppedAndReason_Name_2]
,SOURCE.[medicationStoppedAndReason_ReasonStopped_2]
,SOURCE.[medicationStoppedAndReason_Name_3]
,SOURCE.[medicationStoppedAndReason_ReasonStopped_3]
,SOURCE.[medicationStoppedAndReason_Name_4]
,SOURCE.[medicationStoppedAndReason_ReasonStopped_4]
,SOURCE.[medicationStoppedAndReason_Name_5]
,SOURCE.[medicationStoppedAndReason_ReasonStopped_5]
,SOURCE.[medicationStoppedAndReason_Name_6]
,SOURCE.[medicationStoppedAndReason_ReasonStopped_6]
,SOURCE.[medicationStoppedAndReason_Name_7]
,SOURCE.[medicationStoppedAndReason_ReasonStopped_7]
,SOURCE.[medicationStoppedAndReason_Name_8]
,SOURCE.[medicationStoppedAndReason_ReasonStopped_8]
,SOURCE.[medicationStoppedAndReason_Name_9]
,SOURCE.[medicationStoppedAndReason_ReasonStopped_9]
,SOURCE.[medicationStoppedAndReason_Name_10]
,SOURCE.[medicationStoppedAndReason_ReasonStopped_10]
,SOURCE.[medicationStoppedAndReason_Name_11]
,SOURCE.[medicationStoppedAndReason_ReasonStopped_11]
,SOURCE.[medicationStoppedAndReason_Name_12]
,SOURCE.[medicationStoppedAndReason_ReasonStopped_12]
,SOURCE.[medicationStoppedAndReason_Name_13]
,SOURCE.[medicationStoppedAndReason_ReasonStopped_13]
,SOURCE.[medicationStoppedAndReason_Name_14]
,SOURCE.[medicationStoppedAndReason_ReasonStopped_14]
,SOURCE.[medicationStoppedAndReason_Name_15]
,SOURCE.[medicationStoppedAndReason_ReasonStopped_15]
,SOURCE.[medicationStoppedAndReason_AdditionalMedicationsStopped]
,SOURCE.[CdStopped_ControlledDrugs]
,SOURCE.[CdStopped_CdName_1]
,SOURCE.[CdStopped_CdName_2]
,SOURCE.[CdStopped_Form_1]
,SOURCE.[CdStopped_Dose_1]
,SOURCE.[CdStopped_Frequency_1]
,SOURCE.[CdStopped_Route_1]
,SOURCE.[CdStopped_TotalQuantityfiguresWords_1]
,SOURCE.[CdStopped_ReasonStopped_1]
,SOURCE.[CdStopped_ReasonStopped_2]
,SOURCE.[CdStopped_Date_1]
,SOURCE.[CdStopped_CdName_3]
,SOURCE.[CdStopped_Form_2]
,SOURCE.[CdStopped_Dose_2]
,SOURCE.[CdStopped_Frequency_2]
,SOURCE.[CdStopped_Route_2]
,SOURCE.[CdStopped_TotalQuantityfiguresWords_2]
,SOURCE.[CdStopped_ReasonStopped_3]
,SOURCE.[CdStopped_Date_2]
,SOURCE.[CdStopped_CdName_4]
,SOURCE.[CdStopped_Form_3]
,SOURCE.[CdStopped_Dose_3]
,SOURCE.[CdStopped_Frequency_3]
,SOURCE.[CdStopped_Route_3]
,SOURCE.[CdStopped_TotalQuantityfiguresWords_3]
,SOURCE.[CdStopped_ReasonStopped_4]
,SOURCE.[CdStopped_Date_3]
,SOURCE.[CdStopped_Name11]
,SOURCE.[CdStopped_Reason11]
,SOURCE.[CdStopped_Name12]
,SOURCE.[CdStopped_Reason12]
,SOURCE.[CdStopped_Name13]
,SOURCE.[CdStopped_Reason13]
,SOURCE.[CdStopped_Name14]
,SOURCE.[CdStopped_Reason14]
,SOURCE.[CdStopped_Name15]
,SOURCE.[CdStopped_Reason15]
,SOURCE.[CdStopped_AdditionalControlledDrugsStopped]
,SOURCE.[prescriberDetails_PrescriberDetails]
,SOURCE.[prescriberDetails_PrescriberContactNumber]
,SOURCE.IsDeleted
)
WHEN MATCHED THEN
UPDATE SET
fkAccountNumber = SOURCE.AccountNumber
,fkPatientLocalID = SOURCE.PatientLocalID
,fkCreatedByStaffID = SOURCE.CreatedByStaffID
,CreatedDateTime = SOURCE.CreatedDateTime
,DocumentStatus = SOURCE.DocumentStatus
,[PatientDetails_PatientDetails] = SOURCE.[PatientDetails_PatientDetails]
,[Heightweight_Height] = SOURCE.[Heightweight_Height]
,[Heightweight_Height_Comment] = SOURCE.[Heightweight_Height_Comment]
,[Heightweight_Weight] = SOURCE.[Heightweight_Weight]
,[Heightweight_Weight_Comment] = SOURCE.[Heightweight_Weight_Comment]
,[Heightweight_BodyMassIndexbmi] = SOURCE.[Heightweight_BodyMassIndexbmi]
,[Aki_Aki] = SOURCE.[Aki_Aki]
,[medicationStartedAndReason_MedicationStartedAndReason] = SOURCE.[medicationStartedAndReason_MedicationStartedAndReason]
,[medicationStartedAndReason_Name_1] = SOURCE.[medicationStartedAndReason_Name_1]
,[medicationStartedAndReason_Dose_1] = SOURCE.[medicationStartedAndReason_Dose_1]
,[medicationStartedAndReason_Frequency_1] = SOURCE.[medicationStartedAndReason_Frequency_1]
,[medicationStartedAndReason_Route_1] = SOURCE.[medicationStartedAndReason_Route_1]
,[medicationStartedAndReason_Route_2] = SOURCE.[medicationStartedAndReason_Route_2]
,[medicationStartedAndReason_NoOfDaysToDispense_1] = SOURCE.[medicationStartedAndReason_NoOfDaysToDispense_1]
,[medicationStartedAndReason_DaysToDispense_1] = SOURCE.[medicationStartedAndReason_DaysToDispense_1]
,[medicationStartedAndReason_ReasonStarted_1] = SOURCE.[medicationStartedAndReason_ReasonStarted_1]
,[medicationStartedAndReason_ReasonStarted_2] = SOURCE.[medicationStartedAndReason_ReasonStarted_2]
,[medicationStartedAndReason_Name_2] = SOURCE.[medicationStartedAndReason_Name_2]
,[medicationStartedAndReason_Dose_2] = SOURCE.[medicationStartedAndReason_Dose_2]
,[medicationStartedAndReason_Frequency_2] = SOURCE.[medicationStartedAndReason_Frequency_2]
,[medicationStartedAndReason_Route_3] = SOURCE.[medicationStartedAndReason_Route_3]
,[medicationStartedAndReason_NoOfDaysToDispense_2] = SOURCE.[medicationStartedAndReason_NoOfDaysToDispense_2]
,[medicationStartedAndReason_DaysToDispense_2] = SOURCE.[medicationStartedAndReason_DaysToDispense_2]
,[medicationStartedAndReason_ReasonStarted_3] = SOURCE.[medicationStartedAndReason_ReasonStarted_3]
,[medicationStartedAndReason_ReasonStarted_4] = SOURCE.[medicationStartedAndReason_ReasonStarted_4]
,[medicationStartedAndReason_Name_3] = SOURCE.[medicationStartedAndReason_Name_3]
,[medicationStartedAndReason_Dose_3] = SOURCE.[medicationStartedAndReason_Dose_3]
,[medicationStartedAndReason_Frequency_3] = SOURCE.[medicationStartedAndReason_Frequency_3]
,[medicationStartedAndReason_Route_4] = SOURCE.[medicationStartedAndReason_Route_4]
,[medicationStartedAndReason_NoOfDaysToDispense_3] = SOURCE.[medicationStartedAndReason_NoOfDaysToDispense_3]
,[medicationStartedAndReason_DaysToDispense_3] = SOURCE.[medicationStartedAndReason_DaysToDispense_3]
,[medicationStartedAndReason_ReasonStarted_5] = SOURCE.[medicationStartedAndReason_ReasonStarted_5]
,[medicationStartedAndReason_ReasonStarted_6] = SOURCE.[medicationStartedAndReason_ReasonStarted_6]
,[medicationStartedAndReason_Name_4] = SOURCE.[medicationStartedAndReason_Name_4]
,[medicationStartedAndReason_Dose_4] = SOURCE.[medicationStartedAndReason_Dose_4]
,[medicationStartedAndReason_Frequency_4] = SOURCE.[medicationStartedAndReason_Frequency_4]
,[medicationStartedAndReason_Route_5] = SOURCE.[medicationStartedAndReason_Route_5]
,[medicationStartedAndReason_NoOfDaysToDispense_4] = SOURCE.[medicationStartedAndReason_NoOfDaysToDispense_4]
,[medicationStartedAndReason_DaysToDispense_4] = SOURCE.[medicationStartedAndReason_DaysToDispense_4]
,[medicationStartedAndReason_ReasonStarted_7] = SOURCE.[medicationStartedAndReason_ReasonStarted_7]
,[medicationStartedAndReason_ReasonStarted_8] = SOURCE.[medicationStartedAndReason_ReasonStarted_8]
,[medicationStartedAndReason_Name_5] = SOURCE.[medicationStartedAndReason_Name_5]
,[medicationStartedAndReason_Dose_5] = SOURCE.[medicationStartedAndReason_Dose_5]
,[medicationStartedAndReason_Frequency_5] = SOURCE.[medicationStartedAndReason_Frequency_5]
,[medicationStartedAndReason_Route_6] = SOURCE.[medicationStartedAndReason_Route_6]
,[medicationStartedAndReason_NoOfDaysToDispense_5] = SOURCE.[medicationStartedAndReason_NoOfDaysToDispense_5]
,[medicationStartedAndReason_DaysToDispense_5] = SOURCE.[medicationStartedAndReason_DaysToDispense_5]
,[medicationStartedAndReason_ReasonStarted_9] = SOURCE.[medicationStartedAndReason_ReasonStarted_9]
,[medicationStartedAndReason_ReasonStarted_10] = SOURCE.[medicationStartedAndReason_ReasonStarted_10]
,[medicationStartedAndReason_Name_6] = SOURCE.[medicationStartedAndReason_Name_6]
,[medicationStartedAndReason_Dose_6] = SOURCE.[medicationStartedAndReason_Dose_6]
,[medicationStartedAndReason_Frequency_6] = SOURCE.[medicationStartedAndReason_Frequency_6]
,[medicationStartedAndReason_Route_7] = SOURCE.[medicationStartedAndReason_Route_7]
,[medicationStartedAndReason_NoOfDaysToDispense_6] = SOURCE.[medicationStartedAndReason_NoOfDaysToDispense_6]
,[medicationStartedAndReason_DaysToDispense_6] = SOURCE.[medicationStartedAndReason_DaysToDispense_6]
,[medicationStartedAndReason_ReasonStarted_11] = SOURCE.[medicationStartedAndReason_ReasonStarted_11]
,[medicationStartedAndReason_ReasonStarted_12] = SOURCE.[medicationStartedAndReason_ReasonStarted_12]
,[medicationStartedAndReason_Name_7] = SOURCE.[medicationStartedAndReason_Name_7]
,[medicationStartedAndReason_Dose_7] = SOURCE.[medicationStartedAndReason_Dose_7]
,[medicationStartedAndReason_Frequency_7] = SOURCE.[medicationStartedAndReason_Frequency_7]
,[medicationStartedAndReason_Route_8] = SOURCE.[medicationStartedAndReason_Route_8]
,[medicationStartedAndReason_NoOfDaysToDispense_7] = SOURCE.[medicationStartedAndReason_NoOfDaysToDispense_7]
,[medicationStartedAndReason_DaysToDispense_7] = SOURCE.[medicationStartedAndReason_DaysToDispense_7]
,[medicationStartedAndReason_ReasonStarted_13] = SOURCE.[medicationStartedAndReason_ReasonStarted_13]
,[medicationStartedAndReason_ReasonStarted_14] = SOURCE.[medicationStartedAndReason_ReasonStarted_14]
,[medicationStartedAndReason_Name_8] = SOURCE.[medicationStartedAndReason_Name_8]
,[medicationStartedAndReason_Dose_8] = SOURCE.[medicationStartedAndReason_Dose_8]
,[medicationStartedAndReason_Frequency_8] = SOURCE.[medicationStartedAndReason_Frequency_8]
,[medicationStartedAndReason_Route_9] = SOURCE.[medicationStartedAndReason_Route_9]
,[medicationStartedAndReason_NoOfDaysToDispense_8] = SOURCE.[medicationStartedAndReason_NoOfDaysToDispense_8]
,[medicationStartedAndReason_DaysToDispense_8] = SOURCE.[medicationStartedAndReason_DaysToDispense_8]
,[medicationStartedAndReason_ReasonStarted_15] = SOURCE.[medicationStartedAndReason_ReasonStarted_15]
,[medicationStartedAndReason_ReasonStarted_16] = SOURCE.[medicationStartedAndReason_ReasonStarted_16]
,[medicationStartedAndReason_Name_9] = SOURCE.[medicationStartedAndReason_Name_9]
,[medicationStartedAndReason_Dose_9] = SOURCE.[medicationStartedAndReason_Dose_9]
,[medicationStartedAndReason_Frequency_9] = SOURCE.[medicationStartedAndReason_Frequency_9]
,[medicationStartedAndReason_Route_10] = SOURCE.[medicationStartedAndReason_Route_10]
,[medicationStartedAndReason_NoOfDaysToDispense_9] = SOURCE.[medicationStartedAndReason_NoOfDaysToDispense_9]
,[medicationStartedAndReason_DaysToDispense_9] = SOURCE.[medicationStartedAndReason_DaysToDispense_9]
,[medicationStartedAndReason_ReasonStarted_17] = SOURCE.[medicationStartedAndReason_ReasonStarted_17]
,[medicationStartedAndReason_ReasonStarted_18] = SOURCE.[medicationStartedAndReason_ReasonStarted_18]
,[medicationStartedAndReason_Name_10] = SOURCE.[medicationStartedAndReason_Name_10]
,[medicationStartedAndReason_Dose_10] = SOURCE.[medicationStartedAndReason_Dose_10]
,[medicationStartedAndReason_Frequency_10] = SOURCE.[medicationStartedAndReason_Frequency_10]
,[medicationStartedAndReason_Route_11] = SOURCE.[medicationStartedAndReason_Route_11]
,[medicationStartedAndReason_DaysToDispense_10] = SOURCE.[medicationStartedAndReason_DaysToDispense_10]
,[medicationStartedAndReason_ReasonStarted_19] = SOURCE.[medicationStartedAndReason_ReasonStarted_19]
,[medicationStartedAndReason_ReasonStarted_20] = SOURCE.[medicationStartedAndReason_ReasonStarted_20]
,[medicationStartedAndReason_Name_11] = SOURCE.[medicationStartedAndReason_Name_11]
,[medicationStartedAndReason_Dose_11] = SOURCE.[medicationStartedAndReason_Dose_11]
,[medicationStartedAndReason_Frequency_11] = SOURCE.[medicationStartedAndReason_Frequency_11]
,[medicationStartedAndReason_Route_12] = SOURCE.[medicationStartedAndReason_Route_12]
,[medicationStartedAndReason_Route_13] = SOURCE.[medicationStartedAndReason_Route_13]
,[medicationStartedAndReason_DaysToDispense_11] = SOURCE.[medicationStartedAndReason_DaysToDispense_11]
,[medicationStartedAndReason_ReasonStarted_21] = SOURCE.[medicationStartedAndReason_ReasonStarted_21]
,[medicationStartedAndReason_Name_12] = SOURCE.[medicationStartedAndReason_Name_12]
,[medicationStartedAndReason_Dose_12] = SOURCE.[medicationStartedAndReason_Dose_12]
,[medicationStartedAndReason_Frequency_12] = SOURCE.[medicationStartedAndReason_Frequency_12]
,[medicationStartedAndReason_Route_14] = SOURCE.[medicationStartedAndReason_Route_14]
,[medicationStartedAndReason_Route_15] = SOURCE.[medicationStartedAndReason_Route_15]
,[medicationStartedAndReason_DaysToDispense_12] = SOURCE.[medicationStartedAndReason_DaysToDispense_12]
,[medicationStartedAndReason_ReasonStarted_22] = SOURCE.[medicationStartedAndReason_ReasonStarted_22]
,[medicationStartedAndReason_Name_13] = SOURCE.[medicationStartedAndReason_Name_13]
,[medicationStartedAndReason_Dose_13] = SOURCE.[medicationStartedAndReason_Dose_13]
,[medicationStartedAndReason_Frequency_13] = SOURCE.[medicationStartedAndReason_Frequency_13]
,[medicationStartedAndReason_Route_16] = SOURCE.[medicationStartedAndReason_Route_16]
,[medicationStartedAndReason_Route_17] = SOURCE.[medicationStartedAndReason_Route_17]
,[medicationStartedAndReason_DaysToDispense_13] = SOURCE.[medicationStartedAndReason_DaysToDispense_13]
,[medicationStartedAndReason_ReasonStarted_23] = SOURCE.[medicationStartedAndReason_ReasonStarted_23]
,[medicationStartedAndReason_Name_14] = SOURCE.[medicationStartedAndReason_Name_14]
,[medicationStartedAndReason_Dose_14] = SOURCE.[medicationStartedAndReason_Dose_14]
,[medicationStartedAndReason_Frequency_14] = SOURCE.[medicationStartedAndReason_Frequency_14]
,[medicationStartedAndReason_Route_18] = SOURCE.[medicationStartedAndReason_Route_18]
,[medicationStartedAndReason_Route_19] = SOURCE.[medicationStartedAndReason_Route_19]
,[medicationStartedAndReason_DaysToDispense_14] = SOURCE.[medicationStartedAndReason_DaysToDispense_14]
,[medicationStartedAndReason_ReasonStarted_24] = SOURCE.[medicationStartedAndReason_ReasonStarted_24]
,[medicationStartedAndReason_Name_15] = SOURCE.[medicationStartedAndReason_Name_15]
,[medicationStartedAndReason_Dose_15] = SOURCE.[medicationStartedAndReason_Dose_15]
,[medicationStartedAndReason_Frequency_15] = SOURCE.[medicationStartedAndReason_Frequency_15]
,[medicationStartedAndReason_Route_20] = SOURCE.[medicationStartedAndReason_Route_20]
,[medicationStartedAndReason_Route_21] = SOURCE.[medicationStartedAndReason_Route_21]
,[medicationStartedAndReason_DaysToDispense_15] = SOURCE.[medicationStartedAndReason_DaysToDispense_15]
,[medicationStartedAndReason_ReasonStarted_25] = SOURCE.[medicationStartedAndReason_ReasonStarted_25]
,[medicationStartedAndReason_AdditionalMedicationsStarted] = SOURCE.[medicationStartedAndReason_AdditionalMedicationsStarted]
,[CdStarted_ControlledDrugs] = SOURCE.[CdStarted_ControlledDrugs]
,[CdStarted_CdName_1] = SOURCE.[CdStarted_CdName_1]
,[CdStarted_Form_1] = SOURCE.[CdStarted_Form_1]
,[CdStarted_Dose_1] = SOURCE.[CdStarted_Dose_1]
,[CdStarted_Frequency_1] = SOURCE.[CdStarted_Frequency_1]
,[CdStarted_Route_1] = SOURCE.[CdStarted_Route_1]
,[CdStarted_TotalQuantityfiguresWords_1] = SOURCE.[CdStarted_TotalQuantityfiguresWords_1]
,[CdStarted_ReasonStarted_1] = SOURCE.[CdStarted_ReasonStarted_1]
,[CdStarted_Date_1] = SOURCE.[CdStarted_Date_1]
,[CdStarted_CdName_2] = SOURCE.[CdStarted_CdName_2]
,[CdStarted_Form_2] = SOURCE.[CdStarted_Form_2]
,[CdStarted_Dose_2] = SOURCE.[CdStarted_Dose_2]
,[CdStarted_Frequency_2] = SOURCE.[CdStarted_Frequency_2]
,[CdStarted_Route_2] = SOURCE.[CdStarted_Route_2]
,[CdStarted_TotalQuantityfiguresWords_2] = SOURCE.[CdStarted_TotalQuantityfiguresWords_2]
,[CdStarted_ReasonStarted_2] = SOURCE.[CdStarted_ReasonStarted_2]
,[CdStarted_Date_2] = SOURCE.[CdStarted_Date_2]
,[CdStarted_CdName_3] = SOURCE.[CdStarted_CdName_3]
,[CdStarted_Form_3] = SOURCE.[CdStarted_Form_3]
,[CdStarted_Dose_3] = SOURCE.[CdStarted_Dose_3]
,[CdStarted_Frequency_3] = SOURCE.[CdStarted_Frequency_3]
,[CdStarted_Route_3] = SOURCE.[CdStarted_Route_3]
,[CdStarted_TotalQuantityfiguresWords_3] = SOURCE.[CdStarted_TotalQuantityfiguresWords_3]
,[CdStarted_ReasonStarted_3] = SOURCE.[CdStarted_ReasonStarted_3]
,[CdStarted_Date_3] = SOURCE.[CdStarted_Date_3]
,[CdStarted_AdditonalControlledDrugsStarted] = SOURCE.[CdStarted_AdditonalControlledDrugsStarted]
,[doseChangeToContinuedMedAndReason_DoseChangedToContinuedMedsAndReason] = SOURCE.[doseChangeToContinuedMedAndReason_DoseChangedToContinuedMedsAndReason]
,[doseChangeToContinuedMedAndReason_Name_1] = SOURCE.[doseChangeToContinuedMedAndReason_Name_1]
,[doseChangeToContinuedMedAndReason_Dose_1] = SOURCE.[doseChangeToContinuedMedAndReason_Dose_1]
,[doseChangeToContinuedMedAndReason_Frequency_1] = SOURCE.[doseChangeToContinuedMedAndReason_Frequency_1]
,[doseChangeToContinuedMedAndReason_Route_1] = SOURCE.[doseChangeToContinuedMedAndReason_Route_1]
,[doseChangeToContinuedMedAndReason_DaysToDispense_1] = SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_1]
,[doseChangeToContinuedMedAndReason_ReasonChanged_1] = SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_1]
,[doseChangeToContinuedMedAndReason_Name_2] = SOURCE.[doseChangeToContinuedMedAndReason_Name_2]
,[doseChangeToContinuedMedAndReason_Dose_2] = SOURCE.[doseChangeToContinuedMedAndReason_Dose_2]
,[doseChangeToContinuedMedAndReason_Frequency_2] = SOURCE.[doseChangeToContinuedMedAndReason_Frequency_2]
,[doseChangeToContinuedMedAndReason_Route_2] = SOURCE.[doseChangeToContinuedMedAndReason_Route_2]
,[doseChangeToContinuedMedAndReason_DaysToDispense_2] = SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_2]
,[doseChangeToContinuedMedAndReason_ReasonChanged_2] = SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_2]
,[doseChangeToContinuedMedAndReason_Name_3] = SOURCE.[doseChangeToContinuedMedAndReason_Name_3]
,[doseChangeToContinuedMedAndReason_Dose_3] = SOURCE.[doseChangeToContinuedMedAndReason_Dose_3]
,[doseChangeToContinuedMedAndReason_Frequency_3] = SOURCE.[doseChangeToContinuedMedAndReason_Frequency_3]
,[doseChangeToContinuedMedAndReason_Route_3] = SOURCE.[doseChangeToContinuedMedAndReason_Route_3]
,[doseChangeToContinuedMedAndReason_DaysToDispense_3] = SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_3]
,[doseChangeToContinuedMedAndReason_ReasonChanged_3] = SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_3]
,[doseChangeToContinuedMedAndReason_Name_4] = SOURCE.[doseChangeToContinuedMedAndReason_Name_4]
,[doseChangeToContinuedMedAndReason_Dose_4] = SOURCE.[doseChangeToContinuedMedAndReason_Dose_4]
,[doseChangeToContinuedMedAndReason_Frequency_4] = SOURCE.[doseChangeToContinuedMedAndReason_Frequency_4]
,[doseChangeToContinuedMedAndReason_Route_4] = SOURCE.[doseChangeToContinuedMedAndReason_Route_4]
,[doseChangeToContinuedMedAndReason_DaysToDispense_4] = SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_4]
,[doseChangeToContinuedMedAndReason_ReasonChanged_4] = SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_4]
,[doseChangeToContinuedMedAndReason_Name_5] = SOURCE.[doseChangeToContinuedMedAndReason_Name_5]
,[doseChangeToContinuedMedAndReason_Dose_5] = SOURCE.[doseChangeToContinuedMedAndReason_Dose_5]
,[doseChangeToContinuedMedAndReason_Frequency_5] = SOURCE.[doseChangeToContinuedMedAndReason_Frequency_5]
,[doseChangeToContinuedMedAndReason_Route_5] = SOURCE.[doseChangeToContinuedMedAndReason_Route_5]
,[doseChangeToContinuedMedAndReason_DaysToDispense_5] = SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_5]
,[doseChangeToContinuedMedAndReason_ReasonChanged_5] = SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_5]
,[doseChangeToContinuedMedAndReason_Name_6] = SOURCE.[doseChangeToContinuedMedAndReason_Name_6]
,[doseChangeToContinuedMedAndReason_Dose_6] = SOURCE.[doseChangeToContinuedMedAndReason_Dose_6]
,[doseChangeToContinuedMedAndReason_Frequency_6] = SOURCE.[doseChangeToContinuedMedAndReason_Frequency_6]
,[doseChangeToContinuedMedAndReason_Route_6] = SOURCE.[doseChangeToContinuedMedAndReason_Route_6]
,[doseChangeToContinuedMedAndReason_DaysToDispense_6] = SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_6]
,[doseChangeToContinuedMedAndReason_ReasonChanged_6] = SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_6]
,[doseChangeToContinuedMedAndReason_Name_7] = SOURCE.[doseChangeToContinuedMedAndReason_Name_7]
,[doseChangeToContinuedMedAndReason_Dose_7] = SOURCE.[doseChangeToContinuedMedAndReason_Dose_7]
,[doseChangeToContinuedMedAndReason_Frequency_7] = SOURCE.[doseChangeToContinuedMedAndReason_Frequency_7]
,[doseChangeToContinuedMedAndReason_Route_7] = SOURCE.[doseChangeToContinuedMedAndReason_Route_7]
,[doseChangeToContinuedMedAndReason_DaysToDispense_7] = SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_7]
,[doseChangeToContinuedMedAndReason_ReasonChanged_7] = SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_7]
,[doseChangeToContinuedMedAndReason_Name_8] = SOURCE.[doseChangeToContinuedMedAndReason_Name_8]
,[doseChangeToContinuedMedAndReason_Dose_8] = SOURCE.[doseChangeToContinuedMedAndReason_Dose_8]
,[doseChangeToContinuedMedAndReason_Frequency_8] = SOURCE.[doseChangeToContinuedMedAndReason_Frequency_8]
,[doseChangeToContinuedMedAndReason_Route_8] = SOURCE.[doseChangeToContinuedMedAndReason_Route_8]
,[doseChangeToContinuedMedAndReason_DaysToDispense_8] = SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_8]
,[doseChangeToContinuedMedAndReason_ReasonChanged_8] = SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_8]
,[doseChangeToContinuedMedAndReason_Name_9] = SOURCE.[doseChangeToContinuedMedAndReason_Name_9]
,[doseChangeToContinuedMedAndReason_Dose_9] = SOURCE.[doseChangeToContinuedMedAndReason_Dose_9]
,[doseChangeToContinuedMedAndReason_Frequency_9] = SOURCE.[doseChangeToContinuedMedAndReason_Frequency_9]
,[doseChangeToContinuedMedAndReason_Route_9] = SOURCE.[doseChangeToContinuedMedAndReason_Route_9]
,[doseChangeToContinuedMedAndReason_DaysToDispense_9] = SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_9]
,[doseChangeToContinuedMedAndReason_ReasonChanged_9] = SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_9]
,[doseChangeToContinuedMedAndReason_Name_10] = SOURCE.[doseChangeToContinuedMedAndReason_Name_10]
,[doseChangeToContinuedMedAndReason_Dose_10] = SOURCE.[doseChangeToContinuedMedAndReason_Dose_10]
,[doseChangeToContinuedMedAndReason_Frequency_10] = SOURCE.[doseChangeToContinuedMedAndReason_Frequency_10]
,[doseChangeToContinuedMedAndReason_Route_10] = SOURCE.[doseChangeToContinuedMedAndReason_Route_10]
,[doseChangeToContinuedMedAndReason_DaysToDispense_10] = SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_10]
,[doseChangeToContinuedMedAndReason_ReasonChanged_10] = SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_10]
,[doseChangeToContinuedMedAndReason_Name_11] = SOURCE.[doseChangeToContinuedMedAndReason_Name_11]
,[doseChangeToContinuedMedAndReason_Dose_11] = SOURCE.[doseChangeToContinuedMedAndReason_Dose_11]
,[doseChangeToContinuedMedAndReason_Frequency_11] = SOURCE.[doseChangeToContinuedMedAndReason_Frequency_11]
,[doseChangeToContinuedMedAndReason_Route_11] = SOURCE.[doseChangeToContinuedMedAndReason_Route_11]
,[doseChangeToContinuedMedAndReason_DaysToDispense_11] = SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_11]
,[doseChangeToContinuedMedAndReason_ReasonChanged_11] = SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_11]
,[doseChangeToContinuedMedAndReason_Name_12] = SOURCE.[doseChangeToContinuedMedAndReason_Name_12]
,[doseChangeToContinuedMedAndReason_Dose_12] = SOURCE.[doseChangeToContinuedMedAndReason_Dose_12]
,[doseChangeToContinuedMedAndReason_Frequency_12] = SOURCE.[doseChangeToContinuedMedAndReason_Frequency_12]
,[doseChangeToContinuedMedAndReason_Route_12] = SOURCE.[doseChangeToContinuedMedAndReason_Route_12]
,[doseChangeToContinuedMedAndReason_DaysToDispense_12] = SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_12]
,[doseChangeToContinuedMedAndReason_ReasonChanged_12] = SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_12]
,[doseChangeToContinuedMedAndReason_Name_13] = SOURCE.[doseChangeToContinuedMedAndReason_Name_13]
,[doseChangeToContinuedMedAndReason_Dose_13] = SOURCE.[doseChangeToContinuedMedAndReason_Dose_13]
,[doseChangeToContinuedMedAndReason_Frequency_13] = SOURCE.[doseChangeToContinuedMedAndReason_Frequency_13]
,[doseChangeToContinuedMedAndReason_Route_13] = SOURCE.[doseChangeToContinuedMedAndReason_Route_13]
,[doseChangeToContinuedMedAndReason_DaysToDispense_13] = SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_13]
,[doseChangeToContinuedMedAndReason_ReasonChanged_13] = SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_13]
,[doseChangeToContinuedMedAndReason_Name_14] = SOURCE.[doseChangeToContinuedMedAndReason_Name_14]
,[doseChangeToContinuedMedAndReason_Dose_14] = SOURCE.[doseChangeToContinuedMedAndReason_Dose_14]
,[doseChangeToContinuedMedAndReason_Frequency_14] = SOURCE.[doseChangeToContinuedMedAndReason_Frequency_14]
,[doseChangeToContinuedMedAndReason_Route_14] = SOURCE.[doseChangeToContinuedMedAndReason_Route_14]
,[doseChangeToContinuedMedAndReason_DaysToDispense_14] = SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_14]
,[doseChangeToContinuedMedAndReason_ReasonChanged_14] = SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_14]
,[doseChangeToContinuedMedAndReason_Name_15] = SOURCE.[doseChangeToContinuedMedAndReason_Name_15]
,[doseChangeToContinuedMedAndReason_Dose_15] = SOURCE.[doseChangeToContinuedMedAndReason_Dose_15]
,[doseChangeToContinuedMedAndReason_Frequency_15] = SOURCE.[doseChangeToContinuedMedAndReason_Frequency_15]
,[doseChangeToContinuedMedAndReason_Route_15] = SOURCE.[doseChangeToContinuedMedAndReason_Route_15]
,[doseChangeToContinuedMedAndReason_DaysToDispense_15] = SOURCE.[doseChangeToContinuedMedAndReason_DaysToDispense_15]
,[doseChangeToContinuedMedAndReason_ReasonChanged_15] = SOURCE.[doseChangeToContinuedMedAndReason_ReasonChanged_15]
,[doseChangeToContinuedMedAndReason_AdditonalMedicationsDoseChanged] = SOURCE.[doseChangeToContinuedMedAndReason_AdditonalMedicationsDoseChanged]
,[CdDoseChanged_ControlledDrugs] = SOURCE.[CdDoseChanged_ControlledDrugs]
,[CdDoseChanged_CdName_1] = SOURCE.[CdDoseChanged_CdName_1]
,[CdDoseChanged_Form_1] = SOURCE.[CdDoseChanged_Form_1]
,[CdDoseChanged_Form_2] = SOURCE.[CdDoseChanged_Form_2]
,[CdDoseChanged_Dose_1] = SOURCE.[CdDoseChanged_Dose_1]
,[CdDoseChanged_Frequency_1] = SOURCE.[CdDoseChanged_Frequency_1]
,[CdDoseChanged_Frequency_2] = SOURCE.[CdDoseChanged_Frequency_2]
,[CdDoseChanged_Route_1] = SOURCE.[CdDoseChanged_Route_1]
,[CdDoseChanged_TotalQuantityfiguresWords_1] = SOURCE.[CdDoseChanged_TotalQuantityfiguresWords_1]
,[CdDoseChanged_TotalQuantityfiguresWords_2] = SOURCE.[CdDoseChanged_TotalQuantityfiguresWords_2]
,[CdDoseChanged_ReasonForChange_1] = SOURCE.[CdDoseChanged_ReasonForChange_1]
,[CdDoseChanged_Date_1] = SOURCE.[CdDoseChanged_Date_1]
,[CdDoseChanged_CdName_2] = SOURCE.[CdDoseChanged_CdName_2]
,[CdDoseChanged_Form_3] = SOURCE.[CdDoseChanged_Form_3]
,[CdDoseChanged_Dose_2] = SOURCE.[CdDoseChanged_Dose_2]
,[CdDoseChanged_Frequency_3] = SOURCE.[CdDoseChanged_Frequency_3]
,[CdDoseChanged_Route_2] = SOURCE.[CdDoseChanged_Route_2]
,[CdDoseChanged_TotalQuantityfiguresWords_3] = SOURCE.[CdDoseChanged_TotalQuantityfiguresWords_3]
,[CdDoseChanged_ReasonForChange_2] = SOURCE.[CdDoseChanged_ReasonForChange_2]
,[CdDoseChanged_Date_2] = SOURCE.[CdDoseChanged_Date_2]
,[CdDoseChanged_CdName_3] = SOURCE.[CdDoseChanged_CdName_3]
,[CdDoseChanged_Form_4] = SOURCE.[CdDoseChanged_Form_4]
,[CdDoseChanged_Dose_3] = SOURCE.[CdDoseChanged_Dose_3]
,[CdDoseChanged_Frequency_4] = SOURCE.[CdDoseChanged_Frequency_4]
,[CdDoseChanged_Route_3] = SOURCE.[CdDoseChanged_Route_3]
,[CdDoseChanged_TotalQuantityfiguresWords_4] = SOURCE.[CdDoseChanged_TotalQuantityfiguresWords_4]
,[CdDoseChanged_ReasonForChange_3] = SOURCE.[CdDoseChanged_ReasonForChange_3]
,[CdDoseChanged_Date_3] = SOURCE.[CdDoseChanged_Date_3]
,[CdDoseChanged_AdditonalControlledDrugsDoseChanged] = SOURCE.[CdDoseChanged_AdditonalControlledDrugsDoseChanged]
,[medicationContinuedUnchanged_MedicationContinuedUnchanged] = SOURCE.[medicationContinuedUnchanged_MedicationContinuedUnchanged]
,[medicationContinuedUnchanged_Name_1] = SOURCE.[medicationContinuedUnchanged_Name_1]
,[medicationContinuedUnchanged_Dose_1] = SOURCE.[medicationContinuedUnchanged_Dose_1]
,[medicationContinuedUnchanged_Frequency_1] = SOURCE.[medicationContinuedUnchanged_Frequency_1]
,[medicationContinuedUnchanged_Route_1] = SOURCE.[medicationContinuedUnchanged_Route_1]
,[medicationContinuedUnchanged_DaysToDispense_1] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_1]
,[medicationContinuedUnchanged_Name_2] = SOURCE.[medicationContinuedUnchanged_Name_2]
,[medicationContinuedUnchanged_Dose_2] = SOURCE.[medicationContinuedUnchanged_Dose_2]
,[medicationContinuedUnchanged_Frequency_2] = SOURCE.[medicationContinuedUnchanged_Frequency_2]
,[medicationContinuedUnchanged_Route_2] = SOURCE.[medicationContinuedUnchanged_Route_2]
,[medicationContinuedUnchanged_DaysToDispense_2] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_2]
,[medicationContinuedUnchanged_Name_3] = SOURCE.[medicationContinuedUnchanged_Name_3]
,[medicationContinuedUnchanged_Dose_3] = SOURCE.[medicationContinuedUnchanged_Dose_3]
,[medicationContinuedUnchanged_Frequency_3] = SOURCE.[medicationContinuedUnchanged_Frequency_3]
,[medicationContinuedUnchanged_Route_3] = SOURCE.[medicationContinuedUnchanged_Route_3]
,[medicationContinuedUnchanged_DaysToDispense_3] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_3]
,[medicationContinuedUnchanged_Name_4] = SOURCE.[medicationContinuedUnchanged_Name_4]
,[medicationContinuedUnchanged_Dose_4] = SOURCE.[medicationContinuedUnchanged_Dose_4]
,[medicationContinuedUnchanged_Frequency_4] = SOURCE.[medicationContinuedUnchanged_Frequency_4]
,[medicationContinuedUnchanged_Route_4] = SOURCE.[medicationContinuedUnchanged_Route_4]
,[medicationContinuedUnchanged_DaysToDispense_4] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_4]
,[medicationContinuedUnchanged_Name_5] = SOURCE.[medicationContinuedUnchanged_Name_5]
,[medicationContinuedUnchanged_Dose_5] = SOURCE.[medicationContinuedUnchanged_Dose_5]
,[medicationContinuedUnchanged_Frequency_5] = SOURCE.[medicationContinuedUnchanged_Frequency_5]
,[medicationContinuedUnchanged_Route_5] = SOURCE.[medicationContinuedUnchanged_Route_5]
,[medicationContinuedUnchanged_DaysToDispense_5] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_5]
,[medicationContinuedUnchanged_Name_6] = SOURCE.[medicationContinuedUnchanged_Name_6]
,[medicationContinuedUnchanged_Dose_6] = SOURCE.[medicationContinuedUnchanged_Dose_6]
,[medicationContinuedUnchanged_Frequency_6] = SOURCE.[medicationContinuedUnchanged_Frequency_6]
,[medicationContinuedUnchanged_Route_6] = SOURCE.[medicationContinuedUnchanged_Route_6]
,[medicationContinuedUnchanged_DaysToDispense_6] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_6]
,[medicationContinuedUnchanged_Name_7] = SOURCE.[medicationContinuedUnchanged_Name_7]
,[medicationContinuedUnchanged_Dose_7] = SOURCE.[medicationContinuedUnchanged_Dose_7]
,[medicationContinuedUnchanged_Frequency_7] = SOURCE.[medicationContinuedUnchanged_Frequency_7]
,[medicationContinuedUnchanged_Route_7] = SOURCE.[medicationContinuedUnchanged_Route_7]
,[medicationContinuedUnchanged_DaysToDispense_7] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_7]
,[medicationContinuedUnchanged_Name_8] = SOURCE.[medicationContinuedUnchanged_Name_8]
,[medicationContinuedUnchanged_Dose_8] = SOURCE.[medicationContinuedUnchanged_Dose_8]
,[medicationContinuedUnchanged_Frequency_8] = SOURCE.[medicationContinuedUnchanged_Frequency_8]
,[medicationContinuedUnchanged_Route_8] = SOURCE.[medicationContinuedUnchanged_Route_8]
,[medicationContinuedUnchanged_DaysToDispense_8] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_8]
,[medicationContinuedUnchanged_Name_9] = SOURCE.[medicationContinuedUnchanged_Name_9]
,[medicationContinuedUnchanged_Dose_9] = SOURCE.[medicationContinuedUnchanged_Dose_9]
,[medicationContinuedUnchanged_Frequency_9] = SOURCE.[medicationContinuedUnchanged_Frequency_9]
,[medicationContinuedUnchanged_Route_9] = SOURCE.[medicationContinuedUnchanged_Route_9]
,[medicationContinuedUnchanged_DaysToDispense_9] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_9]
,[medicationContinuedUnchanged_Name_10] = SOURCE.[medicationContinuedUnchanged_Name_10]
,[medicationContinuedUnchanged_Dose_10] = SOURCE.[medicationContinuedUnchanged_Dose_10]
,[medicationContinuedUnchanged_Frequency_10] = SOURCE.[medicationContinuedUnchanged_Frequency_10]
,[medicationContinuedUnchanged_Route_10] = SOURCE.[medicationContinuedUnchanged_Route_10]
,[medicationContinuedUnchanged_DaysToDispense_10] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_10]
,[medicationContinuedUnchanged_Name_11] = SOURCE.[medicationContinuedUnchanged_Name_11]
,[medicationContinuedUnchanged_Dose_11] = SOURCE.[medicationContinuedUnchanged_Dose_11]
,[medicationContinuedUnchanged_Frequency_11] = SOURCE.[medicationContinuedUnchanged_Frequency_11]
,[medicationContinuedUnchanged_Route_11] = SOURCE.[medicationContinuedUnchanged_Route_11]
,[medicationContinuedUnchanged_DaysToDispense_11] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_11]
,[medicationContinuedUnchanged_Name_12] = SOURCE.[medicationContinuedUnchanged_Name_12]
,[medicationContinuedUnchanged_Dose_12] = SOURCE.[medicationContinuedUnchanged_Dose_12]
,[medicationContinuedUnchanged_Frequency_12] = SOURCE.[medicationContinuedUnchanged_Frequency_12]
,[medicationContinuedUnchanged_Route_12] = SOURCE.[medicationContinuedUnchanged_Route_12]
,[medicationContinuedUnchanged_DaysToDispense_12] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_12]
,[medicationContinuedUnchanged_Name_13] = SOURCE.[medicationContinuedUnchanged_Name_13]
,[medicationContinuedUnchanged_Dose_13] = SOURCE.[medicationContinuedUnchanged_Dose_13]
,[medicationContinuedUnchanged_Frequency_13] = SOURCE.[medicationContinuedUnchanged_Frequency_13]
,[medicationContinuedUnchanged_Route_13] = SOURCE.[medicationContinuedUnchanged_Route_13]
,[medicationContinuedUnchanged_DaysToDispense_13] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_13]
,[medicationContinuedUnchanged_Name_14] = SOURCE.[medicationContinuedUnchanged_Name_14]
,[medicationContinuedUnchanged_Dose_14] = SOURCE.[medicationContinuedUnchanged_Dose_14]
,[medicationContinuedUnchanged_Frequency_14] = SOURCE.[medicationContinuedUnchanged_Frequency_14]
,[medicationContinuedUnchanged_Route_14] = SOURCE.[medicationContinuedUnchanged_Route_14]
,[medicationContinuedUnchanged_DaysToDispense_14] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_14]
,[medicationContinuedUnchanged_Name_15] = SOURCE.[medicationContinuedUnchanged_Name_15]
,[medicationContinuedUnchanged_Dose_15] = SOURCE.[medicationContinuedUnchanged_Dose_15]
,[medicationContinuedUnchanged_Frequency_15] = SOURCE.[medicationContinuedUnchanged_Frequency_15]
,[medicationContinuedUnchanged_Route_15] = SOURCE.[medicationContinuedUnchanged_Route_15]
,[medicationContinuedUnchanged_DaysToDispense_15] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_15]
,[medicationContinuedUnchanged_Name_16] = SOURCE.[medicationContinuedUnchanged_Name_16]
,[medicationContinuedUnchanged_Dose_16] = SOURCE.[medicationContinuedUnchanged_Dose_16]
,[medicationContinuedUnchanged_Frequency_16] = SOURCE.[medicationContinuedUnchanged_Frequency_16]
,[medicationContinuedUnchanged_Route_16] = SOURCE.[medicationContinuedUnchanged_Route_16]
,[medicationContinuedUnchanged_DaysToDispense_16] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_16]
,[medicationContinuedUnchanged_Name_17] = SOURCE.[medicationContinuedUnchanged_Name_17]
,[medicationContinuedUnchanged_Dose_17] = SOURCE.[medicationContinuedUnchanged_Dose_17]
,[medicationContinuedUnchanged_Frequency_17] = SOURCE.[medicationContinuedUnchanged_Frequency_17]
,[medicationContinuedUnchanged_Route_17] = SOURCE.[medicationContinuedUnchanged_Route_17]
,[medicationContinuedUnchanged_DaysToDispense_17] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_17]
,[medicationContinuedUnchanged_Name_18] = SOURCE.[medicationContinuedUnchanged_Name_18]
,[medicationContinuedUnchanged_Dose_18] = SOURCE.[medicationContinuedUnchanged_Dose_18]
,[medicationContinuedUnchanged_Frequency_18] = SOURCE.[medicationContinuedUnchanged_Frequency_18]
,[medicationContinuedUnchanged_Route_18] = SOURCE.[medicationContinuedUnchanged_Route_18]
,[medicationContinuedUnchanged_DaysToDispense_18] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_18]
,[medicationContinuedUnchanged_Name_19] = SOURCE.[medicationContinuedUnchanged_Name_19]
,[medicationContinuedUnchanged_Dose_19] = SOURCE.[medicationContinuedUnchanged_Dose_19]
,[medicationContinuedUnchanged_Frequency_19] = SOURCE.[medicationContinuedUnchanged_Frequency_19]
,[medicationContinuedUnchanged_Route_19] = SOURCE.[medicationContinuedUnchanged_Route_19]
,[medicationContinuedUnchanged_DaysToDispense_19] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_19]
,[medicationContinuedUnchanged_Name_20] = SOURCE.[medicationContinuedUnchanged_Name_20]
,[medicationContinuedUnchanged_Dose_20] = SOURCE.[medicationContinuedUnchanged_Dose_20]
,[medicationContinuedUnchanged_Frequency_20] = SOURCE.[medicationContinuedUnchanged_Frequency_20]
,[medicationContinuedUnchanged_Route_20] = SOURCE.[medicationContinuedUnchanged_Route_20]
,[medicationContinuedUnchanged_DaysToDispense_20] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_20]
,[medicationContinuedUnchanged_Name_21] = SOURCE.[medicationContinuedUnchanged_Name_21]
,[medicationContinuedUnchanged_Dose_21] = SOURCE.[medicationContinuedUnchanged_Dose_21]
,[medicationContinuedUnchanged_Frequency_21] = SOURCE.[medicationContinuedUnchanged_Frequency_21]
,[medicationContinuedUnchanged_Route_21] = SOURCE.[medicationContinuedUnchanged_Route_21]
,[medicationContinuedUnchanged_DaysToDispense_21] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_21]
,[medicationContinuedUnchanged_Name_22] = SOURCE.[medicationContinuedUnchanged_Name_22]
,[medicationContinuedUnchanged_Dose_22] = SOURCE.[medicationContinuedUnchanged_Dose_22]
,[medicationContinuedUnchanged_Frequency_22] = SOURCE.[medicationContinuedUnchanged_Frequency_22]
,[medicationContinuedUnchanged_Route_22] = SOURCE.[medicationContinuedUnchanged_Route_22]
,[medicationContinuedUnchanged_DaysToDispense_22] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_22]
,[medicationContinuedUnchanged_Name_23] = SOURCE.[medicationContinuedUnchanged_Name_23]
,[medicationContinuedUnchanged_Dose_23] = SOURCE.[medicationContinuedUnchanged_Dose_23]
,[medicationContinuedUnchanged_Frequency_23] = SOURCE.[medicationContinuedUnchanged_Frequency_23]
,[medicationContinuedUnchanged_Route_23] = SOURCE.[medicationContinuedUnchanged_Route_23]
,[medicationContinuedUnchanged_DaysToDispense_23] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_23]
,[medicationContinuedUnchanged_Name_24] = SOURCE.[medicationContinuedUnchanged_Name_24]
,[medicationContinuedUnchanged_Dose_24] = SOURCE.[medicationContinuedUnchanged_Dose_24]
,[medicationContinuedUnchanged_Frequency_24] = SOURCE.[medicationContinuedUnchanged_Frequency_24]
,[medicationContinuedUnchanged_Route_24] = SOURCE.[medicationContinuedUnchanged_Route_24]
,[medicationContinuedUnchanged_DaysToDispense_24] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_24]
,[medicationContinuedUnchanged_Name_25] = SOURCE.[medicationContinuedUnchanged_Name_25]
,[medicationContinuedUnchanged_Dose_25] = SOURCE.[medicationContinuedUnchanged_Dose_25]
,[medicationContinuedUnchanged_Frequency_25] = SOURCE.[medicationContinuedUnchanged_Frequency_25]
,[medicationContinuedUnchanged_Route_25] = SOURCE.[medicationContinuedUnchanged_Route_25]
,[medicationContinuedUnchanged_DaysToDispense_25] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_25]
,[medicationContinuedUnchanged_Name_26] = SOURCE.[medicationContinuedUnchanged_Name_26]
,[medicationContinuedUnchanged_Dose_26] = SOURCE.[medicationContinuedUnchanged_Dose_26]
,[medicationContinuedUnchanged_Frequency_26] = SOURCE.[medicationContinuedUnchanged_Frequency_26]
,[medicationContinuedUnchanged_Route_26] = SOURCE.[medicationContinuedUnchanged_Route_26]
,[medicationContinuedUnchanged_DaysToDispense_26] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_26]
,[medicationContinuedUnchanged_Name_27] = SOURCE.[medicationContinuedUnchanged_Name_27]
,[medicationContinuedUnchanged_Dose_27] = SOURCE.[medicationContinuedUnchanged_Dose_27]
,[medicationContinuedUnchanged_Frequency_27] = SOURCE.[medicationContinuedUnchanged_Frequency_27]
,[medicationContinuedUnchanged_Route_27] = SOURCE.[medicationContinuedUnchanged_Route_27]
,[medicationContinuedUnchanged_DaysToDispense_27] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_27]
,[medicationContinuedUnchanged_Name_28] = SOURCE.[medicationContinuedUnchanged_Name_28]
,[medicationContinuedUnchanged_Dose_28] = SOURCE.[medicationContinuedUnchanged_Dose_28]
,[medicationContinuedUnchanged_Frequency_28] = SOURCE.[medicationContinuedUnchanged_Frequency_28]
,[medicationContinuedUnchanged_Route_28] = SOURCE.[medicationContinuedUnchanged_Route_28]
,[medicationContinuedUnchanged_DaysToDispense_28] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_28]
,[medicationContinuedUnchanged_Name_29] = SOURCE.[medicationContinuedUnchanged_Name_29]
,[medicationContinuedUnchanged_Dose_29] = SOURCE.[medicationContinuedUnchanged_Dose_29]
,[medicationContinuedUnchanged_Frequency_29] = SOURCE.[medicationContinuedUnchanged_Frequency_29]
,[medicationContinuedUnchanged_Route_29] = SOURCE.[medicationContinuedUnchanged_Route_29]
,[medicationContinuedUnchanged_DaysToDispense_29] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_29]
,[medicationContinuedUnchanged_Name_30] = SOURCE.[medicationContinuedUnchanged_Name_30]
,[medicationContinuedUnchanged_Dose_30] = SOURCE.[medicationContinuedUnchanged_Dose_30]
,[medicationContinuedUnchanged_Frequency_30] = SOURCE.[medicationContinuedUnchanged_Frequency_30]
,[medicationContinuedUnchanged_Route_30] = SOURCE.[medicationContinuedUnchanged_Route_30]
,[medicationContinuedUnchanged_DaysToDispense_30] = SOURCE.[medicationContinuedUnchanged_DaysToDispense_30]
,[medicationContinuedUnchanged_AdditionalMedicationsContinuedUnchanged] = SOURCE.[medicationContinuedUnchanged_AdditionalMedicationsContinuedUnchanged]
,[CdContinuedUnchanged_ControlledDrugs] = SOURCE.[CdContinuedUnchanged_ControlledDrugs]
,[CdContinuedUnchanged_CdName_1] = SOURCE.[CdContinuedUnchanged_CdName_1]
,[CdContinuedUnchanged_CdName_2] = SOURCE.[CdContinuedUnchanged_CdName_2]
,[CdContinuedUnchanged_Form_1] = SOURCE.[CdContinuedUnchanged_Form_1]
,[CdContinuedUnchanged_Form_2] = SOURCE.[CdContinuedUnchanged_Form_2]
,[CdContinuedUnchanged_Form_3] = SOURCE.[CdContinuedUnchanged_Form_3]
,[CdContinuedUnchanged_Dose_1] = SOURCE.[CdContinuedUnchanged_Dose_1]
,[CdContinuedUnchanged_Dose_2] = SOURCE.[CdContinuedUnchanged_Dose_2]
,[CdContinuedUnchanged_Dose_3] = SOURCE.[CdContinuedUnchanged_Dose_3]
,[CdContinuedUnchanged_Frequency_1] = SOURCE.[CdContinuedUnchanged_Frequency_1]
,[CdContinuedUnchanged_Frequency_2] = SOURCE.[CdContinuedUnchanged_Frequency_2]
,[CdContinuedUnchanged_Route_1] = SOURCE.[CdContinuedUnchanged_Route_1]
,[CdContinuedUnchanged_Route_2] = SOURCE.[CdContinuedUnchanged_Route_2]
,[CdContinuedUnchanged_TotalQuantityfiguresWords_1] = SOURCE.[CdContinuedUnchanged_TotalQuantityfiguresWords_1]
,[CdContinuedUnchanged_TotalQuantityfiguresWords_2] = SOURCE.[CdContinuedUnchanged_TotalQuantityfiguresWords_2]
,[CdContinuedUnchanged_ReasonToContinue_1] = SOURCE.[CdContinuedUnchanged_ReasonToContinue_1]
,[CdContinuedUnchanged_ReasonToContinue_2] = SOURCE.[CdContinuedUnchanged_ReasonToContinue_2]
,[CdContinuedUnchanged_Date_1] = SOURCE.[CdContinuedUnchanged_Date_1]
,[CdContinuedUnchanged_Date_2] = SOURCE.[CdContinuedUnchanged_Date_2]
,[CdContinuedUnchanged_CdName_3] = SOURCE.[CdContinuedUnchanged_CdName_3]
,[CdContinuedUnchanged_Form_4] = SOURCE.[CdContinuedUnchanged_Form_4]
,[CdContinuedUnchanged_Form_5] = SOURCE.[CdContinuedUnchanged_Form_5]
,[CdContinuedUnchanged_Dose_4] = SOURCE.[CdContinuedUnchanged_Dose_4]
,[CdContinuedUnchanged_Dose_5] = SOURCE.[CdContinuedUnchanged_Dose_5]
,[CdContinuedUnchanged_Frequency_3] = SOURCE.[CdContinuedUnchanged_Frequency_3]
,[CdContinuedUnchanged_Route_3] = SOURCE.[CdContinuedUnchanged_Route_3]
,[CdContinuedUnchanged_TotalQuantityfiguresWords_3] = SOURCE.[CdContinuedUnchanged_TotalQuantityfiguresWords_3]
,[CdContinuedUnchanged_ReasonToContinue_3] = SOURCE.[CdContinuedUnchanged_ReasonToContinue_3]
,[CdContinuedUnchanged_Date_3] = SOURCE.[CdContinuedUnchanged_Date_3]
,[CdContinuedUnchanged_CdName_4] = SOURCE.[CdContinuedUnchanged_CdName_4]
,[CdContinuedUnchanged_Form_6] = SOURCE.[CdContinuedUnchanged_Form_6]
,[CdContinuedUnchanged_Form_7] = SOURCE.[CdContinuedUnchanged_Form_7]
,[CdContinuedUnchanged_Dose_6] = SOURCE.[CdContinuedUnchanged_Dose_6]
,[CdContinuedUnchanged_Dose_7] = SOURCE.[CdContinuedUnchanged_Dose_7]
,[CdContinuedUnchanged_Frequency_4] = SOURCE.[CdContinuedUnchanged_Frequency_4]
,[CdContinuedUnchanged_Route_4] = SOURCE.[CdContinuedUnchanged_Route_4]
,[CdContinuedUnchanged_TotalQuantityfiguresWords_4] = SOURCE.[CdContinuedUnchanged_TotalQuantityfiguresWords_4]
,[CdContinuedUnchanged_ReasonToContinue_4] = SOURCE.[CdContinuedUnchanged_ReasonToContinue_4]
,[CdContinuedUnchanged_Date_4] = SOURCE.[CdContinuedUnchanged_Date_4]
,[CdContinuedUnchanged_AdditionalControlledDrugsUnchanged] = SOURCE.[CdContinuedUnchanged_AdditionalControlledDrugsUnchanged]
,[medicationStoppedAndReason_MedicationStoppedAndReason] = SOURCE.[medicationStoppedAndReason_MedicationStoppedAndReason]
,[medicationStoppedAndReason_Name_1] = SOURCE.[medicationStoppedAndReason_Name_1]
,[medicationStoppedAndReason_ReasonStopped_1] = SOURCE.[medicationStoppedAndReason_ReasonStopped_1]
,[medicationStoppedAndReason_Name_2] = SOURCE.[medicationStoppedAndReason_Name_2]
,[medicationStoppedAndReason_ReasonStopped_2] = SOURCE.[medicationStoppedAndReason_ReasonStopped_2]
,[medicationStoppedAndReason_Name_3] = SOURCE.[medicationStoppedAndReason_Name_3]
,[medicationStoppedAndReason_ReasonStopped_3] = SOURCE.[medicationStoppedAndReason_ReasonStopped_3]
,[medicationStoppedAndReason_Name_4] = SOURCE.[medicationStoppedAndReason_Name_4]
,[medicationStoppedAndReason_ReasonStopped_4] = SOURCE.[medicationStoppedAndReason_ReasonStopped_4]
,[medicationStoppedAndReason_Name_5] = SOURCE.[medicationStoppedAndReason_Name_5]
,[medicationStoppedAndReason_ReasonStopped_5] = SOURCE.[medicationStoppedAndReason_ReasonStopped_5]
,[medicationStoppedAndReason_Name_6] = SOURCE.[medicationStoppedAndReason_Name_6]
,[medicationStoppedAndReason_ReasonStopped_6] = SOURCE.[medicationStoppedAndReason_ReasonStopped_6]
,[medicationStoppedAndReason_Name_7] = SOURCE.[medicationStoppedAndReason_Name_7]
,[medicationStoppedAndReason_ReasonStopped_7] = SOURCE.[medicationStoppedAndReason_ReasonStopped_7]
,[medicationStoppedAndReason_Name_8] = SOURCE.[medicationStoppedAndReason_Name_8]
,[medicationStoppedAndReason_ReasonStopped_8] = SOURCE.[medicationStoppedAndReason_ReasonStopped_8]
,[medicationStoppedAndReason_Name_9] = SOURCE.[medicationStoppedAndReason_Name_9]
,[medicationStoppedAndReason_ReasonStopped_9] = SOURCE.[medicationStoppedAndReason_ReasonStopped_9]
,[medicationStoppedAndReason_Name_10] = SOURCE.[medicationStoppedAndReason_Name_10]
,[medicationStoppedAndReason_ReasonStopped_10] = SOURCE.[medicationStoppedAndReason_ReasonStopped_10]
,[medicationStoppedAndReason_Name_11] = SOURCE.[medicationStoppedAndReason_Name_11]
,[medicationStoppedAndReason_ReasonStopped_11] = SOURCE.[medicationStoppedAndReason_ReasonStopped_11]
,[medicationStoppedAndReason_Name_12] = SOURCE.[medicationStoppedAndReason_Name_12]
,[medicationStoppedAndReason_ReasonStopped_12] = SOURCE.[medicationStoppedAndReason_ReasonStopped_12]
,[medicationStoppedAndReason_Name_13] = SOURCE.[medicationStoppedAndReason_Name_13]
,[medicationStoppedAndReason_ReasonStopped_13] = SOURCE.[medicationStoppedAndReason_ReasonStopped_13]
,[medicationStoppedAndReason_Name_14] = SOURCE.[medicationStoppedAndReason_Name_14]
,[medicationStoppedAndReason_ReasonStopped_14] = SOURCE.[medicationStoppedAndReason_ReasonStopped_14]
,[medicationStoppedAndReason_Name_15] = SOURCE.[medicationStoppedAndReason_Name_15]
,[medicationStoppedAndReason_ReasonStopped_15] = SOURCE.[medicationStoppedAndReason_ReasonStopped_15]
,[medicationStoppedAndReason_AdditionalMedicationsStopped] = SOURCE.[medicationStoppedAndReason_AdditionalMedicationsStopped]
,[CdStopped_ControlledDrugs] = SOURCE.[CdStopped_ControlledDrugs]
,[CdStopped_CdName_1] = SOURCE.[CdStopped_CdName_1]
,[CdStopped_CdName_2] = SOURCE.[CdStopped_CdName_2]
,[CdStopped_Form_1] = SOURCE.[CdStopped_Form_1]
,[CdStopped_Dose_1] = SOURCE.[CdStopped_Dose_1]
,[CdStopped_Frequency_1] = SOURCE.[CdStopped_Frequency_1]
,[CdStopped_Route_1] = SOURCE.[CdStopped_Route_1]
,[CdStopped_TotalQuantityfiguresWords_1] = SOURCE.[CdStopped_TotalQuantityfiguresWords_1]
,[CdStopped_ReasonStopped_1] = SOURCE.[CdStopped_ReasonStopped_1]
,[CdStopped_ReasonStopped_2] = SOURCE.[CdStopped_ReasonStopped_2]
,[CdStopped_Date_1] = SOURCE.[CdStopped_Date_1]
,[CdStopped_CdName_3] = SOURCE.[CdStopped_CdName_3]
,[CdStopped_Form_2] = SOURCE.[CdStopped_Form_2]
,[CdStopped_Dose_2] = SOURCE.[CdStopped_Dose_2]
,[CdStopped_Frequency_2] = SOURCE.[CdStopped_Frequency_2]
,[CdStopped_Route_2] = SOURCE.[CdStopped_Route_2]
,[CdStopped_TotalQuantityfiguresWords_2] = SOURCE.[CdStopped_TotalQuantityfiguresWords_2]
,[CdStopped_ReasonStopped_3] = SOURCE.[CdStopped_ReasonStopped_3]
,[CdStopped_Date_2] = SOURCE.[CdStopped_Date_2]
,[CdStopped_CdName_4] = SOURCE.[CdStopped_CdName_4]
,[CdStopped_Form_3] = SOURCE.[CdStopped_Form_3]
,[CdStopped_Dose_3] = SOURCE.[CdStopped_Dose_3]
,[CdStopped_Frequency_3] = SOURCE.[CdStopped_Frequency_3]
,[CdStopped_Route_3] = SOURCE.[CdStopped_Route_3]
,[CdStopped_TotalQuantityfiguresWords_3] = SOURCE.[CdStopped_TotalQuantityfiguresWords_3]
,[CdStopped_ReasonStopped_4] = SOURCE.[CdStopped_ReasonStopped_4]
,[CdStopped_Date_3] = SOURCE.[CdStopped_Date_3]
,[CdStopped_Name11] = SOURCE.[CdStopped_Name11]
,[CdStopped_Reason11] = SOURCE.[CdStopped_Reason11]
,[CdStopped_Name12] = SOURCE.[CdStopped_Name12]
,[CdStopped_Reason12] = SOURCE.[CdStopped_Reason12]
,[CdStopped_Name13] = SOURCE.[CdStopped_Name13]
,[CdStopped_Reason13] = SOURCE.[CdStopped_Reason13]
,[CdStopped_Name14] = SOURCE.[CdStopped_Name14]
,[CdStopped_Reason14] = SOURCE.[CdStopped_Reason14]
,[CdStopped_Name15] = SOURCE.[CdStopped_Name15]
,[CdStopped_Reason15] = SOURCE.[CdStopped_Reason15]
,[CdStopped_AdditionalControlledDrugsStopped] = SOURCE.[CdStopped_AdditionalControlledDrugsStopped]
,[prescriberDetails_PrescriberDetails] = SOURCE.[prescriberDetails_PrescriberDetails]
,[prescriberDetails_PrescriberContactNumber] = SOURCE.[prescriberDetails_PrescriberContactNumber]
,IsDeleted = SOURCE.IsDeleted
;
END
As you can see, there's no data transformation taking place at all.
April 19, 2018 at 8:53 am
Jeff Moden - Thursday, April 19, 2018 8:46 AMrichardmgreen1 - Thursday, April 19, 2018 8:20 AMZZartin - Thursday, April 19, 2018 8:08 AMrichardmgreen1 - Thursday, April 19, 2018 8:00 AMI'm aware you suggested running it against a single table, but this is on our development server (with backups) and we have a lot of tables with this issue.It looks like we'll need to find another way of loading this data.
I'm still confused as to why it loads into our staging area without an issue but chokes when we move it to the "proper" table for reporting purposes.
How exactly are you moving the data? You mentioned you were doing a merge and doing insert/update are you modifying the data during that process?
We've tried doing a MERGE as well as INSERT/UPDATE separately.
Both give the same error. There's no changes happening to the data at the point of the move.Jeff Moden - Thursday, April 19, 2018 8:09 AMrichardmgreen1 - Wednesday, April 18, 2018 6:32 AMThe tables are, for the most part, identical.I know it seems too obvious but I suspect that if you can identify where they are different, you'll have your answer.
I've posted both table create statements in my OP (I think).
There's one extra field in the "actual" table (SYSDateLoaded) and, apart from that and a few minor field name changes to keep to our naming conventions (pk for Primary Key, fk for Foreign Key, etc) I can't see any differences.Happy for a second (or even third) pair of eyes though.
Yes. I know you've posted the DDL for both tables. I just don't have the time to do a comparison. Just wanted to make sure that you did.
Yeah, I put both create statements into Excel and did a "does this equal that".
That ones that didn't I could explain with the slight change of name (or the inclusion of a primary key in the actual table which gave extra statements).
I'll try it in SQL Compare (now we've managed to get work to pay for the licence).
::edit::
Just used SQL Compare and the tables are identical apart from 4 minor differences:-
1) Small name changes (as mentioned before, this is for our naming conventions)
2) Differences in NULL allowances (allowed on staging table but not on actual table but not for all fields)
3) Actual table has a trigger and a clustered primary key on it.
4) There are two indexes on the actual table. These are nonclustered indexes on fkAccountNumber and fkPatientLocalID
I'm not sure how much difference the trigger will make as it only updates the SYSDateLastUpdated field to today's date so we can track when the data changes. I know the indexes will add a little overhead but don't really want to get rid of them.
Viewing 15 posts - 1 through 15 (of 30 total)
You must be logged in to reply to this topic. Login to reply