Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Trigger not firing on perf mon table

Author  Topic 

hollpe01
Starting Member

1 Post

Posted - 2010-03-19 : 10:40:17
Hi

I am trying to extend the functionality of performance monitor. I have written a really simple trigger that works on the CounterData table;


CREATE TRIGGER trg_CounterData
ON CounterData
FOR INSERT, UPDATE
AS
BEGIN
DECLARE @CounterID int, @RecordIndex int, @CounterValue float
declare cur cursor static local for
select counterid, recordindex, countervalue
from inserted
open cur
while 1=1
BEGIN
fetch cur into @CounterID, @RecordIndex, @CounterValue
if @@fetch_status <> 0
BREAK
insert mytable(CounterID, RecordIndex,countervalue, restarted)
values(@Counterid, @RecordIndex, @CounterValue, 0)
END
deallocate cur
END

If I put a row into the CounterData table through query analyser, the trigger fires and my table gets populated. However, when system monitoring puts a row in the CounterData table, the trigger does not fire (or maybe it does, but my table does not get populated).

Any suggestions gratefully received.
   

- Advertisement -