Question

Must I increment a integer version column within an update (before) trigger?

Or is there something like ON UPDATE AUTOINCREMENT similar to ON UPDATE CURRENT_TIMESTAMP within table column declaration?

In SQL there is something like a rowversion column type for that case.

Was it helpful?

Solution

Try

delimiter //
create trigger inc_trg before update on your_table
for each row 
begin    
  set new.some_column = new.some_column + 1;
end
//
delimiter ;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top