Compile function Delete_BOM_Record_From_SQL(Connection, Key, Record)

/*****************************************************************************\
	Deletes the given BOM record from the MSSQL database.
	
	History
	-------
	04/29/2011    KRF   Original Programmer
\*****************************************************************************/

Declare function SQL_Delete, SQL_Format
Ans = ""
				    
// List of key names and their values
Keys = "BOM_NO":@VM:SQL_Format(Key, "INT")

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

!! Delete records from MV tables first !!

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

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

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

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

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

Return Ans
