Compile function Copy_SURFACE_SCAN_Record_To_SQL(Connection, Key, Record)

/*****************************************************************************\
	Copies the given SURFACE_SCAN record to the MSSQL database.
	
	History
	-------
	07/13/2010    KRF   Original Programmer
	04/21/2012    KRF   Dropped per David's Request, SQL_MFS Removed so this
	                    won't be called
\*****************************************************************************/

$insert SURFACE_SCAN_EQUATES

Declare function SQL_Write, SQL_Write_MV, SQL_Format
Ans = ""

// Parse record into a dimensioned array for speed
Dim Rec(53)
MatParse Record into Rec
					    
// List of key names and their values
Keys  = "WO_NO"  :@VM:SQL_Format(Field(Key, "*", 1), "INT"):@FM
Keys := "WO_STEP":@VM:SQL_Format(Field(Key, "*", 2), "INT"):@FM
Keys := "CASS_NO":@VM:SQL_Format(Field(Key, "*", 3), "INT"):@FM
Keys := "STAGE"  :@VM:SQL_Format(Field(Key, "*", 4), "STR")

// List of data fields and their values
DataFields  = "RDS_NO"          :@VM:SQL_Format(Rec(SURFACE_SCAN_RDS_NO$),           "INT"):@FM
DataFields := "SCAN_DTM"        :@VM:SQL_Format(Rec(SURFACE_SCAN_SCAN_DTM$),         "DATETIME"):@FM
DataFields := "LOT_ID"          :@VM:SQL_Format(Rec(SURFACE_SCAN_LOT_ID$),           "STR"):@FM
DataFields := "LPD_CNT_MAX"     :@VM:SQL_Format(Rec(SURFACE_SCAN_LPD_CNT_MAX$),      "INT"):@FM
DataFields := "LPD_CNT_AVG"     :@VM:SQL_Format(Rec(SURFACE_SCAN_LPD_CNT_AVG$),      "DEC", "3"):@FM
DataFields := "LPD_CNT_STDV"    :@VM:SQL_Format(Rec(SURFACE_SCAN_LPD_CNT_STDV$),     "DEC", "3"):@FM
DataFields := "LPD_AREA_MIN"    :@VM:SQL_Format(Rec(SURFACE_SCAN_LPD_AREA_MIN$),     "DEC", "3"):@FM
DataFields := "LPD_AREA_MAX"    :@VM:SQL_Format(Rec(SURFACE_SCAN_LPD_AREA_MAX$),     "DEC", "3"):@FM
DataFields := "LPD_AREA_AVG"    :@VM:SQL_Format(Rec(SURFACE_SCAN_LPD_AREA_AVG$),     "DEC", "3"):@FM
DataFields := "LPD_AREA_STDV"   :@VM:SQL_Format(Rec(SURFACE_SCAN_LPD_AREA_STDV$),    "DEC", "3"):@FM
DataFields := "AREA_CNT_MIN"    :@VM:SQL_Format(Rec(SURFACE_SCAN_AREA_CNT_MIN$),     "INT"):@FM
DataFields := "AREA_CNT_MAX"    :@VM:SQL_Format(Rec(SURFACE_SCAN_AREA_CNT_MAX$),     "INT"):@FM
DataFields := "AREA_CNT_AVG"    :@VM:SQL_Format(Rec(SURFACE_SCAN_AREA_CNT_AVG$),     "DEC", "3"):@FM
DataFields := "AREA_CNT_STDV"   :@VM:SQL_Format(Rec(SURFACE_SCAN_AREA_CNT_STDV$),    "DEC", "3"):@FM
DataFields := "AREA_TOT_MIN"    :@VM:SQL_Format(Rec(SURFACE_SCAN_AREA_TOT_MIN$),     "DEC", "3"):@FM
DataFields := "AREA_TOT_MAX"    :@VM:SQL_Format(Rec(SURFACE_SCAN_AREA_TOT_MAX$),     "DEC", "3"):@FM
DataFields := "AREA_TOT_AVG"    :@VM:SQL_Format(Rec(SURFACE_SCAN_AREA_TOT_AVG$),     "DEC", "3"):@FM
DataFields := "AREA_TOT_STDV"   :@VM:SQL_Format(Rec(SURFACE_SCAN_AREA_TOT_STDV$),    "DEC", "3"):@FM
DataFields := "SCRATCH_CNT_MIN" :@VM:SQL_Format(Rec(SURFACE_SCAN_SCRATCH_CNT_MIN$),  "INT"):@FM
DataFields := "SCRATCH_CNT_MAX" :@VM:SQL_Format(Rec(SURFACE_SCAN_SCRATCH_CNT_MAX$),  "INT"):@FM
DataFields := "SCRATCH_CNT_AVG" :@VM:SQL_Format(Rec(SURFACE_SCAN_SCRATCH_CNT_AVG$),  "DEC", "3"):@FM
DataFields := "SCRATCH_CNT_STDV":@VM:SQL_Format(Rec(SURFACE_SCAN_SCRATCH_CNT_STDV$), "DEC", "3"):@FM
DataFields := "SCRATCH_TOT_MIN" :@VM:SQL_Format(Rec(SURFACE_SCAN_SCRATCH_TOT_MIN$),  "DEC", "0"):@FM
DataFields := "SCRATCH_TOT_MAX" :@VM:SQL_Format(Rec(SURFACE_SCAN_SCRATCH_TOT_MAX$),  "DEC", "0"):@FM
DataFields := "SCRATCH_TOT_AVG" :@VM:SQL_Format(Rec(SURFACE_SCAN_SCRATCH_TOT_AVG$),  "DEC", "3"):@FM
DataFields := "SCRATCH_TOT_STDV":@VM:SQL_Format(Rec(SURFACE_SCAN_SCRATCH_TOT_STDV$), "DEC", "3"):@FM
DataFields := "SUM_OF_DEF_MIN"  :@VM:SQL_Format(Rec(SURFACE_SCAN_SUM_OF_DEF_MIN$),   "INT"):@FM
DataFields := "SUM_OF_DEF_MAX"  :@VM:SQL_Format(Rec(SURFACE_SCAN_SUM_OF_DEF_MAX$),   "INT"):@FM
DataFields := "SUM_OF_DEF_AVG"  :@VM:SQL_Format(Rec(SURFACE_SCAN_SUM_OF_DEF_AVG$),   "DEC", "3"):@FM
DataFields := "SUM_OF_DEF_STDV" :@VM:SQL_Format(Rec(SURFACE_SCAN_SUM_OF_DEF_STDV$),  "DEC", "3"):@FM
DataFields := "HAZE_RGN_MIN"    :@VM:SQL_Format(Rec(SURFACE_SCAN_HAZE_RGN_MIN$),     "DEC", "2"):@FM
DataFields := "HAZE_RGN_MAX"    :@VM:SQL_Format(Rec(SURFACE_SCAN_HAZE_RGN_MAX$),     "DEC", "2"):@FM
DataFields := "HAZE_RGN_AVG"    :@VM:SQL_Format(Rec(SURFACE_SCAN_HAZE_RGN_AVG$),     "DEC", "3"):@FM
DataFields := "HAZE_RGN_STDV"   :@VM:SQL_Format(Rec(SURFACE_SCAN_HAZE_RGN_STDV$),    "DEC", "3"):@FM
DataFields := "HAZE_AVG_MIN"    :@VM:SQL_Format(Rec(SURFACE_SCAN_HAZE_AVG_MIN$),     "DEC", "0"):@FM
DataFields := "HAZE_AVG_MAX"    :@VM:SQL_Format(Rec(SURFACE_SCAN_HAZE_AVG_MAX$),     "DEC", "0"):@FM
DataFields := "HAZE_AVG_AVG"    :@VM:SQL_Format(Rec(SURFACE_SCAN_HAZE_AVG_AVG$),     "DEC", "3"):@FM
DataFields := "HAZE_AVG_STDV"   :@VM:SQL_Format(Rec(SURFACE_SCAN_HAZE_AVG_STDV$),    "DEC", "3"):@FM
DataFields := "SCAN_TOOL"       :@VM:SQL_Format(Rec(SURFACE_SCAN_SCAN_TOOL$),        "STR"):@FM
DataFields := "SCAN_USER"       :@VM:SQL_Format(Rec(SURFACE_SCAN_SCAN_USER$),        "STR")

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

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

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

Return Ans
