open-insight/LSL2/STPROC/DELETE_CUSTOMER_RECORD_FROM_SQL.txt
Infineon\StieberD 7762b129af pre cutover push
2024-09-04 20:33:41 -07:00

53 lines
1.3 KiB
Plaintext

Compile function Delete_CUSTOMER_Record_From_SQL(Connection, Key, Record)
/*****************************************************************************\
Deletes the given CUSTOMER 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 = "CUST_NO":@VM:SQL_Format(Key, "STR")
//-------------------------------------------------------------------------------------------------
// Multi-valued Fields
!! Delete records from MV tables first !!
// CUSTOMER_NOTES
If Ans EQ "" then
Ans = SQL_Delete(Connection, "CUSTOMER_NOTES", Keys)
end
// CUSTOMER_CARRIERS
If Ans EQ "" then
Ans = SQL_Delete(Connection, "CUSTOMER_CARRIERS", Keys)
end
// CUSTOMER_INTL_PHONES
If Ans EQ "" then
Ans = SQL_Delete(Connection, "CUSTOMER_INTL_PHONES", Keys)
end
// CUSTOMER_PHONES
If Ans EQ "" then
Ans = SQL_Delete(Connection, "CUSTOMER_PHONES", Keys)
end
// CUSTOMER_ADDR_LINES
If Ans EQ "" then
Ans = SQL_Delete(Connection, "CUSTOMER_ADDR_LINES", Keys)
end
// CUSTOMER
If Ans EQ "" then
Ans = SQL_Delete(Connection, "CUSTOMER", Keys)
end
Return Ans