Unanswered: function to get previous record value of a particular column???
can anyone tell me equivalent for lag function in sybase????
for example in oracle we can use lag function to get previous record value of a particular column.
similarly in sybase please let me know the function to get previos record value of particular column.
You can create a trigger for a table to fire on insert, update and/or delete. Within a trigger, the special tables "inserted" and "deleted" are available. Actually, I believe these are special views to the transaction log.
For example, an update trigger could mainatin a log table of changes. the statement "update tableA set col1="new value" could fire an update trigger which has:
select @old_value-d.col1,@new_value=i.col1 from inserted i, deleted d
insert into LogTable values(@old_value,@new_value)