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 |
|
wizardPC
Starting Member
1 Post |
Posted - 2009-12-17 : 14:09:24
|
| I'm not a DBA or a SQL Programmer--I'm just an IT guy presented with a problem I need help figuring out.So here's the situation: We've got a table that normally contains no rows. Data gets inserted into the table with a MESSAGEID, and an external process does something with the data one row at a time then deletes the row. So when that process is idle, there's no rows in the table.Every so often, hundreds of records get dumped into the table and the external process is "off to the races" so to speak. The problem is that sometimes this process hangs, and we don't know it until a user calls to complain.What I've been asked to do is to come up with a method that basically looks at the first record in the table every couple of minutes, and if MESSAGEID is the same twice in a row, write to an error log so our alerting group can fire off some emails.If I can do this as some sort of automated job inside SQL Server 2005, that would be ideal. I'm not above writing some external script that does it, if that's the only way.I probably just need pointing in the right direction. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-12-20 : 03:52:15
|
| seems like what you need is a sql agent job whose first step is to look at first record in table compare it with last records value (if any) and then populate another table with current time and this value. for subsequent runs it will look for most recent record in second table with first record of former table. based on if its equal or not returns status (0 or 1 for failure or success). then if status is 0 do the next step which will be writing to log and sending emails. |
 |
|
|
|
|
|