When an insert or update command executes, the SAP ASE server simultaneously adds rows to both the trigger table and the inserted table. The rows in the inserted table are always duplicates of one or more rows in the trigger table.
An update or insert trigger can use the if update command to determine whether the update or insert changed a particular column. if update (column_name) is true for an insert statement whenever the column is assigned a value in the select list or in the values clause. An explicit NULL or a default assigns a value to a column and thus activates the trigger. An implicit NULL, however, does not.
create table junk (aaa int null, bbb int not null)
create trigger trigtest on junk for insert as if update (aaa) print "aaa updated" if update (bbb) print "bbb updated"
insert junk (aaa, bbb) values (1, 2)
aaa updated bbb updated
insert junk values (NULL, 2)
aaa updated bbb updated
If there was a default for column aaa, the trigger would also fire.
insert junk (bbb) values (2)
bbb updated
if update is never true for a delete statement.