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 2000 Forums
 SQL Server Administration (2000)
 retrieve data from database and attach to email

Author  Topic 

DarkAngle
Starting Member

5 Posts

Posted - 2009-05-14 : 05:00:23
Hi,
my case is like this, when alarm occur in my devices, it will store the data in my SQL2000 database.
I wish when there is any alarm data in the database, it will send an email to my mail with the data log file so that i will know what is the alarm.
So far Im only able to use trigger command to send me a notification email when there is any update in database.
Appreciate if there is any help
Thanks..



SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-05-14 : 05:39:35
You can use sp_dbsendmail, but doing that in a trigger is a BAD idea.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

DarkAngle
Starting Member

5 Posts

Posted - 2009-05-15 : 01:53:42
quote:
Originally posted by Peso

You can use sp_dbsendmail, but doing that in a trigger is a BAD idea.



E 12°55'05.63"
N 56°04'39.26"




hi there,thank for your reply.Did you have any others ideas beside trigger?
Go to Top of Page

tosscrosby
Aged Yak Warrior

676 Posts

Posted - 2009-05-15 : 14:16:21
quote:
Originally posted by DarkAngle


So far Im only able to use trigger command to send me a notification email when there is any update in database.



Do you really wantan email each time the database is updated? Seems like overkill to me. You can set up audit tables, use the trigger to write to those tables and maybe send you a notification email once a day or every hour. Seems a bit more reasonable.

Rereading your OP, are you really looks for alerts (as you mentioned alarms)?

Terry

-- Procrastinate now!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-05-15 : 14:26:26
i would have also thought of logging the updates in a table and then sending mail periodically at a convienient schedule. you can schedule a job in sql server agent to send mail based on data in the logging table after a fixed period
Go to Top of Page

DarkAngle
Starting Member

5 Posts

Posted - 2009-05-15 : 22:32:49
quote:
Originally posted by tosscrosby

quote:
Originally posted by DarkAngle


So far Im only able to use trigger command to send me a notification email when there is any update in database.



Do you really wantan email each time the database is updated? Seems like overkill to me. You can set up audit tables, use the trigger to write to those tables and maybe send you a notification email once a day or every hour. Seems a bit more reasonable.

Rereading your OP, are you really looks for alerts (as you mentioned alarms)?

Terry

-- Procrastinate now!



Yes, i need notification each time the database updated.Actually my firm is an operator,when there is any breakdown to our devices, an alarm will pops up and let me know which device is breakdown in my NMS and in SQL database it will appear same alarm notification.My NMS unable to send the alarm to email, hence im trying to use SQL feature to send the alarm.
The way u suggest is sound nice, can guide me more in detail?
PS: Im new in SQL2000 but what to do since it is order from my manager :(

Thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-05-16 : 03:59:14
http://classicasp.aspfaq.com/email/how-do-i-send-e-mail-from-sql-server.html
Go to Top of Page
   

- Advertisement -