Hi,
I have 2 triggers on a table
1. create trigger l_service on service for insert,update as
declare @num_rows integer
declare @system_timestamp datetime
DECLARE @person_id varchar(30)
select @num_rows=@@ROWCOUNT
if @num_rows=0 return
select @system_timestamp=getdate(*)
SELECT @person_id = person_id from ap_user
UPDATE service_call
SET last_change_datetime = @system_timestamp,
last_change_by = @person_id
FROM service_call, inserted
WHERE service_call.order_id = inserted.order_id
return
2. create trigger
i_service after insert order 99 on service referencing new as new_name
for each row
begin
declare @TempTxID varchar(30);
declare @AfterDate varchar(32);
set @DeltaCol = '';
set @DeltaCol=@DeltaCol || 'order_id,0,';
set @length=coalesce(byte_length(new_name.order_id),-1);
set @DeltaCol=@DeltaCol || convert(varchar(50),@length) || ',';
if (@length > 0) then
set @DeltaCol=@DeltaCol || new_name.order_id
end if;
..... goes on for e rest of the fields including the above mentioned last_change_by
Even though the triggers are ordered the second trigger does not capture the updates by the first one. The updates do end up in the table.
ANy ideas.
Thanks in advance
BalaMani