Compile function Copy_PROD_SPEC_Record_To_SQL(Connection, Key, Record)

/*****************************************************************************\
	Copies the given PROD_SPEC record to the MSSQL database.
	
	History
	-------
	06/03/2010    KRF   Original Programmer
	06/15/2018    dmb   Replace PROD_SPEC_FIRST_VER_INST$ with PROD_SPEC_PROVE_IN_INST$ to fix VNAV. - [IREPIOI-45]
\*****************************************************************************/

$insert PROD_SPEC_EQUATES

Declare function SQL_Write, SQL_Write_MV, SQL_Format
Ans = ""

// Parse record into a dimensioned array for speed
Dim Rec(142)
MatParse Record into Rec
					    
// List of key names and their values
Keys = "SEQ":@VM:SQL_Format(Key, "INT")

// List of data fields and their values
DataFields  = "ENTRY_ID"                  :@VM:SQL_Format(Rec(PROD_SPEC_ENTRY_ID$),                   "STR"):@FM
DataFields := "ENTRY_DATE"                :@VM:SQL_Format(Rec(PROD_SPEC_ENTRY_DATE$),                 "DATE"):@FM
DataFields := "DESCRIPTION"               :@VM:SQL_Format(Rec(PROD_SPEC_DESCRIPTION$),                "STR"):@FM
DataFields := "CUST_ID"                   :@VM:SQL_Format(Rec(PROD_SPEC_CUST_ID$),                    "INT"):@FM
DataFields := "STATUS"                    :@VM:SQL_Format(Rec(PROD_SPEC_STATUS$),                     "STR"):@FM
DataFields := "PRE_EPI_VER"               :@VM:SQL_Format(Rec(PROD_SPEC_PRE_EPI_VER$),                "BIT"):@FM
DataFields := "PROVEIN_MIN"               :@VM:SQL_Format(Rec(PROD_SPEC_PROVEIN_MIN$),                "DEC", "3"):@FM
DataFields := "FIRST_VER_INST"            :@VM:SQL_Format(Rec(PROD_SPEC_PROVE_IN_INST$),              "STR"):@FM
DataFields := "RECIPE_TYPE"               :@VM:SQL_Format(Rec(PROD_SPEC_RECIPE_TYPE$),                "STR"):@FM
DataFields := "UNLOAD_VER_INST"           :@VM:SQL_Format(Rec(PROD_SPEC_UNLOAD_VER_INST$),            "STR"):@FM
DataFields := "POST_EPI_VER_INST"         :@VM:SQL_Format(Rec(PROD_SPEC_POST_EPI_VER_INST$),          "STR"):@FM
DataFields := "SCHEDULING_NOTES"          :@VM:SQL_Format(Rec(PROD_SPEC_SCHEDULING_NOTES$),           "STR"):@FM
DataFields := "SALES_NOTES"               :@VM:SQL_Format(Rec(PROD_SPEC_SALES_NOTES$),                "STR"):@FM
DataFields := "SPEC_BILL_INST"            :@VM:SQL_Format(Rec(PROD_SPEC_SPEC_BILL_INST$),             "STR"):@FM
DataFields := "SPEC_SHIP_INST"            :@VM:SQL_Format(Rec(PROD_SPEC_SPEC_SHIP_INST$),             "STR"):@FM
DataFields := "LOAD_VER"                  :@VM:SQL_Format(Rec(PROD_SPEC_LOAD_VER$),                   "BIT"):@FM
DataFields := "SHIP_CUST_RDS"             :@VM:SQL_Format(Rec(PROD_SPEC_SHIP_CUST_RDS$),              "BIT"):@FM
DataFields := "SHIP_COC_FRONT"            :@VM:SQL_Format(Rec(PROD_SPEC_SHIP_COC_FRONT$),             "BIT"):@FM
DataFields := "SHIP_COC_BACK"             :@VM:SQL_Format(Rec(PROD_SPEC_SHIP_COC_BACK$),              "BIT"):@FM
DataFields := "SHIP_NCR_REJ"              :@VM:SQL_Format(Rec(PROD_SPEC_SHIP_NCR_REJ$),               "DEC", "0"):@FM
DataFields := "FIRST_VER"                 :@VM:SQL_Format(Rec(PROD_SPEC_FIRST_VER$),                  "BIT"):@FM
DataFields := "SHIP_PARTIAL"              :@VM:SQL_Format(Rec(PROD_SPEC_SHIP_PARTIAL$),               "BIT"):@FM
DataFields := "SHIP_FULL_TYPE"            :@VM:SQL_Format(Rec(PROD_SPEC_SHIP_FULL_TYPE$),             "STR"):@FM
DataFields := "SHIP_BAG_REQ"              :@VM:SQL_Format(Rec(PROD_SPEC_SHIP_BAG_REQ$),               "STR"):@FM
DataFields := "TR_SRP"                    :@VM:SQL_Format(Rec(PROD_SPEC_TR_SRP$),                     "BIT"):@FM
DataFields := "TR_FTIR"                   :@VM:SQL_Format(Rec(PROD_SPEC_TR_FTIR$),                    "BIT"):@FM
DataFields := "TR_HGPROBE"                :@VM:SQL_Format(Rec(PROD_SPEC_TR_HGPROBE$),                 "BIT"):@FM
DataFields := "TR_TENCOR"                 :@VM:SQL_Format(Rec(PROD_SPEC_TR_TENCOR$),                  "BIT"):@FM
DataFields := "TR_STRESS"                 :@VM:SQL_Format(Rec(PROD_SPEC_TR_STRESS$),                  "BIT"):@FM
DataFields := "TR_TEST_WAFER"             :@VM:SQL_Format(Rec(PROD_SPEC_TR_TEST_WAFER$),              "BIT"):@FM
DataFields := "TR_SRP_WWAFER"             :@VM:SQL_Format(Rec(PROD_SPEC_TR_SRP_WWAFER$),              "BIT"):@FM
DataFields := "SHIP_COC_FRONT_COPIES"     :@VM:SQL_Format(Rec(PROD_SPEC_SHIP_COC_FRONT_COPIES$),      "INT"):@FM
DataFields := "SHIP_COC_BACK_COPIES"      :@VM:SQL_Format(Rec(PROD_SPEC_SHIP_COC_BACK_COPIES$),       "INT"):@FM
DataFields := "UNLOAD_VER"                :@VM:SQL_Format(Rec(PROD_SPEC_UNLOAD_VER$),                 "BIT"):@FM
DataFields := "TR_4PP"                    :@VM:SQL_Format(Rec(PROD_SPEC_TR_4PP$),                     "BIT"):@FM
DataFields := "HARD_COPY"                 :@VM:SQL_Format(Rec(PROD_SPEC_HARD_COPY$),                  "BIT"):@FM
DataFields := "PRE_PITS"                  :@VM:SQL_Format(Rec(PROD_SPEC_PRE_PITS$),                   "INT"):@FM
DataFields := "PRE_MOUNDS"                :@VM:SQL_Format(Rec(PROD_SPEC_PRE_MOUNDS$),                 "INT"):@FM
DataFields := "PRE_BL_DEFECTS"            :@VM:SQL_Format(Rec(PROD_SPEC_PRE_BL_DEFECTS$),             "INT"):@FM
DataFields := "PRE_SPOTS"                 :@VM:SQL_Format(Rec(PROD_SPEC_PRE_SPOTS$),                  "INT"):@FM
DataFields := "PRE_FOV"                   :@VM:SQL_Format(Rec(PROD_SPEC_PRE_FOV$),                    "INT"):@FM
DataFields := "PRE_SCRATCHES"             :@VM:SQL_Format(Rec(PROD_SPEC_PRE_SCRATCHES$),              "INT"):@FM
DataFields := "PRE_SCRATCH_LEN"           :@VM:SQL_Format(Rec(PROD_SPEC_PRE_SCRATCH_LEN$),            "INT"):@FM
DataFields := "PRE_LPD"                   :@VM:SQL_Format(Rec(PROD_SPEC_PRE_LPD$),                    "INT"):@FM
DataFields := "POST_PITS"                 :@VM:SQL_Format(Rec(PROD_SPEC_POST_PITS$),                  "INT"):@FM
DataFields := "POST_MOUNDS"               :@VM:SQL_Format(Rec(PROD_SPEC_POST_MOUNDS$),                "INT"):@FM
DataFields := "POST_BL_DEFECTS"           :@VM:SQL_Format(Rec(PROD_SPEC_POST_BL_DEFECTS$),            "INT"):@FM
DataFields := "POST_STACK_FAULTS"         :@VM:SQL_Format(Rec(PROD_SPEC_POST_STACK_FAULTS$),          "INT"):@FM
DataFields := "POST_SPOTS"                :@VM:SQL_Format(Rec(PROD_SPEC_POST_SPOTS$),                 "INT"):@FM
DataFields := "POST_FOV"                  :@VM:SQL_Format(Rec(PROD_SPEC_POST_FOV$),                   "INT"):@FM
DataFields := "POST_SPIKES"               :@VM:SQL_Format(Rec(PROD_SPEC_POST_SPIKES$),                "INT"):@FM
DataFields := "POST_SCRATCHES"            :@VM:SQL_Format(Rec(PROD_SPEC_POST_SCRATCHES$),             "INT"):@FM
DataFields := "POST_SCRATCH_LEN"          :@VM:SQL_Format(Rec(PROD_SPEC_POST_SCRATCH_LEN$),           "INT"):@FM
DataFields := "POST_LPD"                  :@VM:SQL_Format(Rec(PROD_SPEC_POST_LPD$),                   "INT"):@FM
DataFields := "SURFACE_SPEC_NOTES"        :@VM:SQL_Format(Rec(PROD_SPEC_SURFACE_SPEC_NOTES$),         "STR"):@FM
DataFields := "PRE_BRIGHTLIGHT"           :@VM:SQL_Format(Rec(PROD_SPEC_PRE_BRIGHTLIGHT$),            "BIT"):@FM
DataFields := "PRE_SURFSCAN"              :@VM:SQL_Format(Rec(PROD_SPEC_PRE_SURFSCAN$),               "BIT"):@FM
DataFields := "PRE_MICROSCOPE"            :@VM:SQL_Format(Rec(PROD_SPEC_PRE_MICROSCOPE$),             "BIT"):@FM
DataFields := "FIRST_BRIGHTLIGHT"         :@VM:SQL_Format(Rec(PROD_SPEC_FIRST_BRIGHTLIGHT$),          "BIT"):@FM
DataFields := "FIRST_SURFSCAN"            :@VM:SQL_Format(Rec(PROD_SPEC_FIRST_SURFSCAN$),             "BIT"):@FM
DataFields := "FIRST_MICROSCOPE"          :@VM:SQL_Format(Rec(PROD_SPEC_FIRST_MICROSCOPE$),           "BIT"):@FM
DataFields := "POST_CLEAN_BRIGHTLIGHT"    :@VM:SQL_Format(Rec(PROD_SPEC_POST_CLEAN_BRIGHTLIGHT$),     "BIT"):@FM
DataFields := "POST_CLEAN_SURFSCAN"       :@VM:SQL_Format(Rec(PROD_SPEC_POST_CLEAN_SURFSCAN$),        "BIT"):@FM
DataFields := "PRE_SURFSCAN_RECIPE"       :@VM:SQL_Format(Rec(PROD_SPEC_PRE_SURFSCAN_RECIPE$),        "STR"):@FM
DataFields := "FIRST_SURFSCAN_RECIPE"     :@VM:SQL_Format(Rec(PROD_SPEC_FIRST_SURFSCAN_RECIPE$),      "STR"):@FM
DataFields := "POST_CLEAN_SURFSCAN_RECIPE":@VM:SQL_Format(Rec(PROD_SPEC_POST_CLEAN_SURFSCAN_RECIPE$), "STR"):@FM
DataFields := "REACTOR_TYPE"              :@VM:SQL_Format(Rec(PROD_SPEC_REACTOR_TYPE$),               "STR"):@FM
DataFields := "POST_EPI_VER"              :@VM:SQL_Format(Rec(PROD_SPEC_POST_EPI_VER$),               "BIT"):@FM
DataFields := "FINAL_VER"                 :@VM:SQL_Format(Rec(PROD_SPEC_FINAL_VER$),                  "BIT"):@FM
DataFields := "PRE_EPI_VER_INST"          :@VM:SQL_Format(Rec(PROD_SPEC_PRE_EPI_VER_INST$),           "STR"):@FM
DataFields := "LOAD_VER_INST"             :@VM:SQL_Format(Rec(PROD_SPEC_LOAD_VER_INST$),              "STR"):@FM
DataFields := "SUPPLIER_CODE"             :@VM:SQL_Format(Rec(PROD_SPEC_SUPPLIER_CODE$),              "STR"):@FM
DataFields := "WAND_RESTRICTER"           :@VM:SQL_Format(Rec(PROD_SPEC_WAND_RESTRICTER$),            "BIT"):@FM
DataFields := "PINNED_SUSCEPTOR"          :@VM:SQL_Format(Rec(PROD_SPEC_PINNED_SUSCEPTOR$),           "BIT"):@FM
DataFields := "TUBE_PRESSURE_TYPE"        :@VM:SQL_Format(Rec(PROD_SPEC_TUBE_PRESSURE_TYPE$),         "STR"):@FM
DataFields := "LAYER_TYPE"                :@VM:SQL_Format(Rec(PROD_SPEC_LAYER_TYPE$),                 "STR"):@FM
DataFields := "FINAL_VER_INST"            :@VM:SQL_Format(Rec(PROD_SPEC_FINAL_VER_INST$),             "STR"):@FM
DataFields := "MINUTES_PER_WAFER"         :@VM:SQL_Format(Rec(PROD_SPEC_MINUTES_PER_WAFER$),          "DEC", "3"):@FM
DataFields := "MONITOR_WAFER_LABEL"       :@VM:SQL_Format(Rec(PROD_SPEC_MONITOR_WAFER_LABEL$),        "BIT"):@FM
DataFields := "PRE_SURF_DEFECTS"          :@VM:SQL_Format(Rec(PROD_SPEC_PRE_SURF_DEFECTS$),           "INT"):@FM
DataFields := "PRE_SURF_HAZE"             :@VM:SQL_Format(Rec(PROD_SPEC_PRE_SURF_HAZE$),              "DEC", "2"):@FM
DataFields := "POST_SURF_DEFECTS"         :@VM:SQL_Format(Rec(PROD_SPEC_POST_SURF_DEFECTS$),          "INT"):@FM
DataFields := "POST_SURF_HAZE"            :@VM:SQL_Format(Rec(PROD_SPEC_POST_SURF_HAZE$),             "DEC", "2"):@FM
DataFields := "POST_CLEAN_SURF_DEFECTS"   :@VM:SQL_Format(Rec(PROD_SPEC_POST_CLEAN_SURF_DEFECTS$),    "INT"):@FM
DataFields := "POST_CLEAN_SURF_HAZE"      :@VM:SQL_Format(Rec(PROD_SPEC_POST_CLEAN_SURF_HAZE$),       "DEC", "2"):@FM
DataFields := "RDS_CLEANROOM_PAPER"       :@VM:SQL_Format(Rec(PROD_SPEC_RDS_CLEANROOM_PAPER$),        "BIT"):@FM
DataFields := "LW_RHO_MIN"                :@VM:SQL_Format(Rec(PROD_SPEC_LW_RHO_MIN$),                 "DEC", "2"):@FM
DataFields := "LW_RHO_MAX"                :@VM:SQL_Format(Rec(PROD_SPEC_LW_RHO_MAX$),                 "DEC", "2"):@FM
DataFields := "SUSCEPTOR_TYPE"            :@VM:SQL_Format(Rec(PROD_SPEC_SUSCEPTOR_TYPE$),             "STR"):@FM
DataFields := "MAKEUP_WAFERS"             :@VM:SQL_Format(Rec(PROD_SPEC_MAKEUP_WAFERS$),              "BIT"):@FM
DataFields := "STD_OH_COST"               :@VM:SQL_Format(Rec(PROD_SPEC_STD_OH_COST$),                "STR"):@FM
DataFields := "MTL_COST"                  :@VM:SQL_Format(Rec(PROD_SPEC_MTL_COST$),                   "STR"):@FM
DataFields := "IR_FAB"                    :@VM:SQL_Format(Rec(PROD_SPEC_IR_FAB$),                     "STR"):@FM
DataFields := "TW_RET_INST"               :@VM:SQL_Format(Rec(PROD_SPEC_TW_RET_INST$),                "STR"):@FM
DataFields := "POST_FWI_LWI"              :@VM:SQL_Format(Rec(PROD_SPEC_POST_FWI_LWI$),               "STR"):@FM
DataFields := "POST_CLEAN_SS_SAMP_QTY"    :@VM:SQL_Format(Rec(PROD_SPEC_POST_CLEAN_SS_SAMP_QTY$),     "INT"):@FM
DataFields := "VERIFY_INSP_REQ"           :@VM:SQL_Format(Rec(PROD_SPEC_VERIFY_INSP_REQ$),            "BIT"):@FM
DataFields := "PI_PARTICLE_QUAL"          :@VM:SQL_Format(Rec(PROD_SPEC_PI_PARTICLE_QUAL$),           "BIT"):@FM
DataFields := "WMO_LOAD_CNT"              :@VM:SQL_Format(Rec(PROD_SPEC_WMO_LOAD_CNT$),               "INT"):@FM
DataFields := "THICKFILM_MET"             :@VM:SQL_Format(Rec(PROD_SPEC_THICKFILM_MET$),              "BIT"):@FM
DataFields := "TEST_POINT_MAP"            :@VM:SQL_Format(Rec(PROD_SPEC_TEST_POINT_MAP$),             "STR"):@FM
DataFields := "RET_REJECTS"               :@VM:SQL_Format(Rec(PROD_SPEC_RET_REJECTS$),                "BIT"):@FM
DataFields := "CASS_SHIP_QTY"             :@VM:SQL_Format(Rec(PROD_SPEC_CASS_SHIP_QTY$),              "INT"):@FM
DataFields := "SMALL_REACTOR_DELTA"       :@VM:SQL_Format(Rec(PROD_SPEC_SMALL_REACTOR_DELTA$),        "BIT"):@FM
DataFields := "DEP_TIME_RATIO"            :@VM:SQL_Format(Rec(PROD_SPEC_DEP_TIME_RATIO$),             "BIT"):@FM
DataFields := "EPI_PRO_SHIP_SHORT"        :@VM:SQL_Format(Rec(PROD_SPEC_EPI_PRO_SHIP_SHORT$),         "BIT"):@FM
DataFields := "SPEC_NEW_DEV"              :@VM:SQL_Format(Rec(PROD_SPEC_SPEC_NEW_DEV$),               "STR", 1):@FM
DataFields := "SPEC_SUBSTRATE"            :@VM:SQL_Format(Rec(PROD_SPEC_SPEC_SUBSTRATE$),             "STR", 1):@FM
DataFields := "SPEC_EPI"                  :@VM:SQL_Format(Rec(PROD_SPEC_SPEC_EPI$),                   "STR", 1):@FM
DataFields := "SPEC_ADDTL"                :@VM:SQL_Format(Rec(PROD_SPEC_SPEC_ADDTL$),                 "STR", 1):@FM
DataFields := "SPEC_PRE_PROD"             :@VM:SQL_Format(Rec(PROD_SPEC_SPEC_PRE_PROD$),              "STR", 1):@FM

// symbolics
DataFields := "CUST_NAME"       :@VM:SQL_Format({CUST_NAME}[1,50],  "STR"):@FM
DataFields := "MERCHANT"        :@VM:SQL_Format({MERCHANT},         "BIT"):@FM
DataFields := "SUB_ORIENTATION" :@VM:SQL_Format({SUB_ORIENTATION},  "STR"):@FM
DataFields := "SUB_SUPPLIED_BY" :@VM:SQL_Format({SUB_SUPPLIED_BY},  "STR"):@FM
DataFields := "SUB_WAFER_DESC"  :@VM:SQL_Format({SUB_WAFER_DESC},   "STR"):@FM
DataFields := "SUB_WAFER_INCHES":@VM:SQL_Format({SUB_WAFER_INCHES}, "STR"):@FM
DataFields := "SUB_WAFER_MM"    :@VM:SQL_Format({SUB_WAFER_MM},     "STR"):@FM
DataFields := "SUB_WAFER_SIZE"  :@VM:SQL_Format({SUB_WAFER_SIZE},   "STR"):@FM
DataFields := "SUB_WAFER_TYPE"  :@VM:SQL_Format({SUB_WAFER_TYPE},   "STR")

// Write the data to the SQL database
Ans = SQL_Write(Connection, "PROD_SPEC", Keys, DataFields)

//-------------------------------------------------------------------------------------------------
// Multi-valued Fields

// PROD_SPEC_SPEC_INFO
If Ans EQ "" AND Rec(PROD_SPEC_SPEC_NUM$) NE "" then
    
    // List of data fields and their values
    MvFields  = "SPEC_NUM" :@FM:SQL_Format(Rec(PROD_SPEC_SPEC_NUM$),  "STR"):@RM
    MvFields := "SPEC_DESC":@FM:SQL_Format(Rec(PROD_SPEC_SPEC_DESC$), "STR"):@RM
    MvFields := "REV_NUM"  :@FM:SQL_Format(Rec(PROD_SPEC_REV_NUM$),   "STR"):@RM
    MvFields := "REV_DATE" :@FM:SQL_Format(Rec(PROD_SPEC_REV_DATE$),  "DATE")
    
    // Write the data to the SQL database
    Ans = SQL_Write_MV(Connection, "PROD_SPEC_SPEC_INFO", Keys, MvFields);
    
end

// PROD_SPEC_MOD_INFO
If Ans EQ "" AND Rec(PROD_SPEC_MOD_ID$) NE "" then
    
    // List of data fields and their values
    MvFields  = "MOD_ID"  :@FM:SQL_Format(Rec(PROD_SPEC_MOD_ID$), "STR"):@RM
    MvFields := "MOD_DATE":@FM:SQL_Format(Rec(PROD_SPEC_MOD_DATE$), "DATE")
    
    // Write the data to the SQL database
    Ans = SQL_Write_MV(Connection, "PROD_SPEC_MOD_INFO", Keys, MvFields);
    
end

// PROD_SPEC_CUST_PART
If Ans EQ "" AND Rec(PROD_SPEC_CUST_PART_NO$) NE "" then
    
    // List of data fields and their values
    MvFields  = "CUST_PART_NO"        :@FM:SQL_Format(Rec(PROD_SPEC_CUST_PART_NO$),         "STR"):@RM
    MvFields := "PN_DESC"             :@FM:SQL_Format(Rec(PROD_SPEC_PN_DESC$),              "STR"):@RM
    MvFields := "INBOUND_CUST_PART_NO":@FM:SQL_Format(Rec(PROD_SPEC_INBOUND_CUST_PART_NO$), "STR")
    
    // Write the data to the SQL database
    Ans = SQL_Write_MV(Connection, "PROD_SPEC_CUST_PART", Keys, MvFields);
    
end

// PROD_SPEC_QUAL_REACTS
If Ans EQ "" AND Rec(PROD_SPEC_QUAL_REACTS$) NE "" then
    
    // List of data fields and their values
    MvFields  = "QUAL_REACTS"   :@FM:SQL_Format(Rec(PROD_SPEC_QUAL_REACTS$),    "INT"):@RM
    MvFields := "BLOCKED_REACTS":@FM:SQL_Format(Rec(PROD_SPEC_BLOCKED_REACTS$), "STR")
    
    // Write the data to the SQL database
    Ans = SQL_Write_MV(Connection, "PROD_SPEC_QUAL_REACTS", Keys, MvFields);
    
end

// PROD_SPEC_EMAIL_NOTIF
If Ans EQ "" AND Rec(PROD_SPEC_SHIP_EMAIL_NOTIF$) NE "" then
    
    // List of data fields and their values
    MvFields  = "SHIP_EMAIL_NOTIF":@FM:SQL_Format(Rec(PROD_SPEC_SHIP_EMAIL_NOTIF$), "STR")
    
    // Write the data to the SQL database
    Ans = SQL_Write_MV(Connection, "PROD_SPEC_EMAIL_NOTIF", Keys, MvFields);
    
end

// PROD_SPEC_SUB_PARTS
If Ans EQ "" AND Rec(PROD_SPEC_SUB_PART_NUMS$) NE "" then
    
    // List of data fields and their values
    MvFields  = "SUB_PART_NUMS":@FM:SQL_Format(Rec(PROD_SPEC_SUB_PART_NUMS$), "STR"):@RM
    MvFields := "SUB_WAFER_MFG":@FM:SQL_Format(Rec(PROD_SPEC_SUB_WAFER_MFG$), "STR")
    
    // Write the data to the SQL database
    Ans = SQL_Write_MV(Connection, "PROD_SPEC_SUB_PARTS", Keys, MvFields);
    
end

// PROD_SPEC_RATIOS
If Ans EQ "" AND Rec(PROD_SPEC_RATIOS$) NE "" then
    
    // List of data fields and their values
    MvFields  = "RATIOS":@FM:SQL_Format(Rec(PROD_SPEC_RATIOS$), "INT")
    
    // Write the data to the SQL database
    Ans = SQL_Write_MV(Connection, "PROD_SPEC_RATIOS", Keys, MvFields);
    
end

// PROD_SPEC_QUOTES
If Ans EQ "" AND Rec(PROD_SPEC_QUOTE_NO$) NE "" then
    
    // List of data fields and their values
    MvFields  = "QUOTE_NO":@FM:SQL_Format(Rec(PROD_SPEC_QUOTE_NO$), "STR")
    
    // Write the data to the SQL database
    Ans = SQL_Write_MV(Connection, "PROD_SPEC_QUOTES", Keys, MvFields);
    
end

// PROD_SPEC_PART_NUMS
If Ans EQ "" AND Rec(PROD_SPEC_PART_NUMS$) NE "" then
    
    // List of data fields and their values
    MvFields  = "PART_NUMS":@FM:SQL_Format(Rec(PROD_SPEC_PART_NUMS$), "STR")
    
    // Write the data to the SQL database
    Ans = SQL_Write_MV(Connection, "PROD_SPEC_PART_NUMS", Keys, MvFields);
    
end

// PROD_SPEC_SCANNED_INFO
If Ans EQ "" AND Rec(PROD_SPEC_SCANNED_IMG_PATH$) NE "" then
    
    // List of data fields and their values
    MvFields  = "SCANNED_IMG_PATH":@FM:SQL_Format(Rec(PROD_SPEC_SCANNED_IMG_PATH$), "STR")
    
    // Write the data to the SQL database
    Ans = SQL_Write_MV(Connection, "PROD_SPEC_SCANNED_INFO", Keys, MvFields);
    
end

Return Ans
