krishnavenkat16 (4/16/2013)
....but the requester is looking for old item i mean records before the update...
You commented the code that does that out:
if @optype = 2 --or @optype = 3
the or @optype = 3 is what puts in the old (pre-update) values in the update case; the code I suggested gives both the pre-update values and the post-update values, so that you can see both what has been changed and what it has been changed to.
The delete case having a null body was a silly omission in what I suggested. the declaration of body needs to be changed to
DECLARE @Body varchar(500); set @Body = '';
so that it isn't null even if there are no new rows.
Tom