Compile function Delete_WO_MAT_Record_From_SQL(Connection, Key, Record)

/*****************************************************************************\
	Deletes the given WO_MAT record from the MSSQL database.
	
	History
	-------
	05/23/2012    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 := "CASS_NO":@VM:SQL_Format(Field(Key, "*", 2), "INT")

//-------------------------------------------------------------------------------------------------
// Multi-valued Fields (Child tables)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Return Ans


