Compile function Copy_REACTOR_PM_Record_To_SQL(Connection, Key, Record)

/*****************************************************************************\
	Copies the given REACTOR_PM record to the MSSQL database.
	
	History
	-------
	08/09/2010    KRF   Original Programmer
\*****************************************************************************/

$insert REACTOR_PM_EQU

Declare function SQL_Write, 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 = "SEQ":@VM:SQL_Format(Key, "INT")

// List of data fields and their values
DataFields  = "REACT_SERV_ID":@VM:SQL_Format(Rec(REACTOR_PM_REACT_SERV_ID$), "INT"):@FM
DataFields := "LAST_DONE"    :@VM:SQL_Format(Rec(REACTOR_PM_LAST_DONE$),     "DATE"):@FM
DataFields := "NEXT_DONE"    :@VM:SQL_Format(Rec(REACTOR_PM_NEXT_DONE$),     "DATE"):@FM
DataFields := "REACTOR"      :@VM:SQL_Format(Rec(REACTOR_PM_REACTOR$),       "INT"):@FM
DataFields := "ENTRY_ID"     :@VM:SQL_Format(Rec(REACTOR_PM_ENTRY_ID$),      "STR"):@FM
DataFields := "ENTRY_DATE"   :@VM:SQL_Format(Rec(REACTOR_PM_ENTRY_DATE$),    "DATE"):@FM
DataFields := "COMPLETE_DATE":@VM:SQL_Format(Rec(REACTOR_PM_COMPLETE_DATE$), "DATE"):@FM
DataFields := "ENTRY_RL_NO"  :@VM:SQL_Format(Rec(REACTOR_PM_ENTRY_RL_NO$),   "STR"):@FM
DataFields := "COMP_RL_NO"   :@VM:SQL_Format(Rec(REACTOR_PM_COMP_RL_NO$),    "STR"):@FM

// Symbolics
DataFields := "SERV_DESC":@VM:SQL_Format({SERV_DESC}, "STR")

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

Return Ans
