Wednesday, January 10, 2018

How can update table's column in a trigger after update on the same table? [SOLVED]

I have done the solution for same table trigger execute , If you change your trigger to BEFORE instead of AFTER you could do it like this:

---------------------------Create Trigger sdbi_csci_products update time-------------------------------------

DELIMITER //
DROP TRIGGER IF EXISTS update_index_date_csci_products//

CREATE DEFINER=root@localhost TRIGGER update_index_date_csci_products
    BEFORE UPDATE ON `sdbi_csci_products`
    FOR EACH ROW
BEGIN

SET NEW.indexdate=NOW();

END//

DELIMITER ;

-------------------------------------Create Trigger sdbi_csci_products insert time-------------------------

DELIMITER //
DROP TRIGGER IF EXISTS insert_index_date_csci_products//

CREATE DEFINER=root@localhost TRIGGER insert_index_date_csci_products
    BEFORE INSERT ON `sdbi_csci_products`
    FOR EACH ROW
BEGIN

SET NEW.indexdate=NOW();

END//

DELIMITER ;

1 comment:


  1. In the event that you are tense in your taekwondo class your body creates more adrenaline. This is your battle flight hormone. It is helpful on the off chance that you are in physical risk. Be that as it may, in class it just consumes your muscle vitality. Also, you are left depleted and tired. You kicks get moderate and substantial.

    Strain additionally makes your muscles solid. Furthermore, firm muscles can't work appropriately. You move more like a robot than a man. Your methods can't stream legitimately. Your kicks get moderate and powerless. What's more, you're more inclined to wounds.For more details:itfofindia.com.

    ReplyDelete