Has anyone ever ran across a program that in a generic manner will execute a sql query and then based on criteria email out alerts. Going to create such a framework but don't want to re create the wheel if I don't have to. It could be used to check various things like if things are setup correctly inside our ERP etc...

Thanks for any thoughts.


  • 1
    What DB engine? – gbn May 27 '10 at 17:03

This will be very heavily dependent on the Operating System you're running on, and the DBMS software you are using. Some database systems include support for doing this kind of thing, while some don't.

If you're running on Linux or Unix, you can often get some great results by using cron for scheduling and running Perl or shell scripts. It's pretty easy, especially with Perl, to run a script, look for specific things in the query results, and then send an e-mail if needed.

I've used this setup (cron + Perl) successfully on numerous occasions on Linux/Unix using PostgreSQL, Oracle, and MySQL.

[Note: I use "Perl" above because I really like Perl, and it works great for me. If you are better with shell scripts, python, ruby, or [insert your favorite language here], use that. Pretty much anything that can interface with the database will probably work.]


SQL Server has SQL Server Agent if you're using that...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.