So here's my problem. I have excel file upload. what i need is I need to insert '1' or '2' in one column while populating data from excel file to sql db depend on the value of another column. is it possible to create trigger that inserts while uploading data in the same table?. Thank you.
CREATE
/*!50017 DEFINER = 'root'@'localhost' */
TRIGGER `trg_utCode` BEFORE INSERT ON `exceldisbursements`
FOR EACH ROW
BEGIN
UPDATE exceldisbursements
SET ut_id = CASE
WHEN ex_responsibility_center LIKE '001-05%' THEN 2
WHEN ex_responsibility_center LIKE '001-5%' THEN 2
ELSE 1
END;
END;
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire