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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 SQL Triggers

Author  Topic 

sql_dan
Starting Member

43 Posts

Posted - 2011-05-04 : 04:22:03
Morning guys,

1st of I have never done a trigger and am looking for some guidance on my particular issue!

Database has 2 tables:

    'Data'
    'Cost'

I have this hooked into a phone system to generate costs of calls etc based on a telnet perl script!
Into the data table I have each call log - so general data 'Date', 'Time' 'Duration' 'Flag' etc.

We have had a few issues lately of the box the perl script is on failing and not finding out for a day or two if when it comes back up the script kicks in.

My thought (and please if there is a better way let me know!!) was to create a trigger script in the data table if there has not been a line after x amount of time. If so using Database Mail fire off an e-mail to me.

If anyone has any ideas or help in creating the trigger I would be very very grateful!

Thanks
Dan

__________________________________________________
If you cant sleep at night, its not the coffee its the bunk!

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2011-05-04 : 11:00:30
A trigger isn't the right tool for this job. I'd probably go with a SQL Agent Job that run every XX minutes or whatever interval makes sense. Then you can just run a bit a SQL to do your check and if that check fails you can raise and error and have the job send an email.
Go to Top of Page

sql_dan
Starting Member

43 Posts

Posted - 2011-05-04 : 11:28:06
The simplest solution is often overlooked!

Thanks for the advice Lamprey!

__________________________________________________
If you cant sleep at night, its not the coffee its the bunk!
Go to Top of Page
   

- Advertisement -