Compile function Copy_REACT_STATUS_Record_To_SQL(Connection, Key, Record)

/*****************************************************************************\
	Copies the given REACT_STATUS record to the MSSQL database.
	
	History
	-------
	06/22/2010    KRF   Original Programmer
\*****************************************************************************/

$insert REACT_STATUS_EQUATES

Declare function SQL_Write, SQL_Write_MV, SQL_Format
Ans = ""

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

// List of data fields and their values
DataFields  = "OUT_OF_PROD_DTM":@VM:SQL_Format(Rec(REACT_STATUS_OUT_OF_PROD_DTM$), "DATETIME")

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

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

// SKELETON CODE
If Ans EQ "" AND Rec(3) NE "" then
    
    // List of data fields and their values:@FM
    MvFields  = "UNLOAD_DTM"    :@FM:SQL_Format(Rec(2), "DATETIME"):@RM
    MvFields := "LOAD_CASS_ID"  :@FM:SQL_Format(Rec(3), "STR"):@RM
    MvFields := "LOAD_DTM"      :@FM:SQL_Format(Rec(4), "DATETIME"):@RM
    MvFields := "UNLOAD_CASS_ID":@FM:SQL_Format(Rec(5), "STR"):@RM
    MvFields := "LOAD_RDS"      :@FM:SQL_Format(Rec(6), "STR"):@RM
    MvFields := "LOAD_RDS_DTM"  :@FM:SQL_Format(Rec(7), "DATETIME"):@RM
    MvFields := "UNLOAD_RDS"    :@FM:SQL_Format(Rec(8), "STR"):@RM
    MvFields := "UNLOAD_RDS_DTM":@FM:SQL_Format(Rec(9), "DATETIME")
    
    // Write the data to the SQL database
    Ans = SQL_Write_MV(Connection, "REACT_STATUS_LOAD", Keys, MvFields);
    
end

Return Ans
