Compile function Delete_WO_STEP_Record_From_SQL(Connection, Key, Record)

/*****************************************************************************\
	Deletes the given WO_STEP record from the MSSQL database.
	
	History
	-------
	09/21/2010    KRF   Original Programmer
\*****************************************************************************/

Declare function SQL_Delete, SQL_Format
Ans = ""
				    
// List of key names and their values
Keys  = "WO_NO"       :@VM:SQL_Format(Field(Key, "*", 1), "INT"):@FM
Keys := "PROC_STEP_NO":@VM:SQL_Format(Field(Key, "*", 2), "INT")

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

!! Delete records from MV tables first !!

// WO_STEP_BLOCKED_REACTORS
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "WO_STEP_BLOCKED_REACTORS", Keys)
end

// WO_STEP_WM_OUT_KEYS
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "WO_STEP_WM_OUT_KEYS", Keys)
end

// WO_STEP_WM_IN_KEYS
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "WO_STEP_WM_IN_KEYS", Keys)
end

// WO_STEP_RDS_CURR_STATUS
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "WO_STEP_RDS_CURR_STATUS", Keys)
end

// WO_STEP_RDS_KEYS
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "WO_STEP_RDS_KEYS", Keys)
end

// WO_STEP_SCHED_ID
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "WO_STEP_SCHED_ID", Keys)
end

// WO_STEP_REACTORS
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "WO_STEP_REACTORS", Keys)
end

// WO_STEP
If Ans EQ "" then
    Ans = SQL_Delete(Connection, "WO_STEP", Keys)
end

Return Ans
