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.
Author |
Topic |
netwerkassist
Starting Member
13 Posts |
Posted - 2006-08-29 : 16:05:34
|
I would like to monitor one of our tables, so that when one field (runstatus) = 3 and there are more than 2 records of this in sucession, I can be emailed this information.This would then give me a heads up our process scheduler is acting up.Would a trigger acomplish this? |
|
eyechart
Master Smack Fu Yak Hacker
3575 Posts |
Posted - 2006-08-29 : 17:08:43
|
First, your table will have to have a column you can use in an ORDER BY to ensure you are looking at the data in the order it was inserted. A column with a default of getdate() might work for this, although I am not certain if you can ever be sure that you can actually retrieve the data from the db in the order tht it was inserted - even with a datetime and/or identity column. People smarter than me will have to address that. In any case, a default value of getdate() on a column you use in the ORDER BY will get you close.As for the trigger, I would reccomend against that. You may just want to set up a scheduled batch job that runs ever x minutes that looks for the pattern you are interested in. -ec |
 |
|
|
|
|