Compile function Copy_GAN_CYCLE_TIME_Record_To_SQL(Connection, Key, Record)

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

$insert GAN_CYCLE_TIME_EQUATES

Declare function SQL_Write, SQL_Write_MV, SQL_Format
Ans = ""

// Parse record into a dimensioned array for speed
Dim Rec(15)
MatParse Record into Rec

// List of key names and their values
Keys = "ID":@VM:SQL_Format(Key, "STR")

// List of data fields and their values
DataFields = ''
DataFields := "WO_NO"           :@VM:SQL_Format(Rec(GAN_CYCLE_TIME_WO_NO$),                     "STR"):@FM
DataFields := "RUN_ID"          :@VM:SQL_Format(Rec(GAN_CYCLE_TIME_RUN_ID$),                    "STR"):@FM
DataFields := "RDS_NO"          :@VM:SQL_Format(Rec(GAN_CYCLE_TIME_RDS_NO$),                    "STR"):@FM
DataFields := "RECIPE"          :@VM:SQL_Format(Rec(GAN_CYCLE_TIME_RECIPE$),                    "STR"):@FM
DataFields := "PART_NO"         :@VM:SQL_Format(Rec(GAN_CYCLE_TIME_PART_NO$),                   "STR"):@FM
DataFields := "PSN_NO"          :@VM:SQL_Format(Rec(GAN_CYCLE_TIME_PSN_NO$),                    "STR"):@FM
DataFields := "STAGE_NAME"      :@VM:SQL_Format(Rec(GAN_CYCLE_TIME_STAGE_NAME$),                "STR"):@FM
DataFields := "TOOL_CLASS"      :@VM:SQL_Format(Rec(GAN_CYCLE_TIME_TOOL_CLASS$),                "STR"):@FM
DataFields := "TOOL"            :@VM:SQL_Format(Rec(GAN_CYCLE_TIME_TOOL$),                      "STR"):@FM
DataFields := "START_DTM"       :@VM:SQL_Format(OCONV(Rec(GAN_CYCLE_TIME_START_DTM$),'DT4/^HS'),"STR"):@FM
DataFields := "STOP_DTM"        :@VM:SQL_Format(OCONV(Rec(GAN_CYCLE_TIME_STOP_DTM$),'DT4/^HS'), "STR"):@FM
DataFields := "OPERATOR_START"  :@VM:SQL_Format(Rec(GAN_CYCLE_TIME_OPERATOR_START$),            "STR"):@FM
DataFields := "OPERATOR_STOP"   :@VM:SQL_Format(Rec(GAN_CYCLE_TIME_OPERATOR_STOP$),             "STR"):@FM
DataFields := "WFR_SCRIBE"      :@VM:SQL_Format(Rec(GAN_CYCLE_TIME_WFR_SCRIBE$),                "STR"):@FM
DataFields := "REACTOR"         :@VM:SQL_Format(Rec(GAN_CYCLE_TIME_REACTOR$),                   "STR")

Ans = SQL_Write(Connection, "GAN_CYCLE_TIME", Keys, DataFields)

Return Ans
