0

Is there some sort of variable where the updated column/row/table is stored that I can access in the script for my trigger?

So lets say row of ID=3 of table 'myTable' has an update query performed on it. Is it possible for me to then perform an update query on table 'anotherTable' with ID=3?

Example Query:

UPDATE myTable SET myColumn=myValue

Example Trigger:

CREATE TRIGGER 'update'
    AFTER UPDATE ON 'myTable'
    BEGIN
        UPDATE 'anotherTable'
            SET netInterest=(myValue * 0.09 /*pseudocode*/)
   END

Can this be done entirely in SQL?

4

1 回答 1

0

您可以尝试使用此代码

CREATE TRIGGER 'Trigger_name'
        AFTER UPDATE ON 'Table_Name'
        BEGIN
            UPDATE 'Another_Table_Name'
                SET Field_Name=10
       END
于 2018-03-05T19:00:58.960 回答