jeudi 3 novembre 2016

MYSQL - Trigger: IF Date is null, set date to CURDATE INTERVAL 1 DAY

Trying to build a simple trigger that modifies the MYSQL database in the following manner AFTER a new record is inserted in the TABLE:

Psudo code:

IF TABLE.AssignedDate IS NULL THEN
Set TABLE.DueDate = CURDATE() + INTERVAL 1
ELSE 
SET TABLE.DueDate = AssignedDate + INTERVAL 1

I'm pretty sure I can't force the TIMESTAMP item from AssignedDate into the Interval 1 scenario. Any help would be appreciated

Aucun commentaire:

Enregistrer un commentaire