|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
alert e-mailHello:
In SQL Server 2000 database I have a table MyTable which is updated daily with previous day data. In some reason data could be missing for particular day. To control the situation I'd like to create alert message to be sent to me by e-mail. The verification SQL statement is: IF (select DATEDIFF ( day , max(datadate) , GetDate() )from MyTable) >1 print 'ALERT!' How can I get the verification result by e-mail? Thanks, GB There are generally three ways to send email from SQL 2000:
1. Install Outlook on the server and configure SQL Mail. You can then use xp_sendmail to send emails. 2. Use xp_smtp_sendmail: http://www.sqldev.net/xp/xpsmtp.htm 3. Use a command-line mailer such as "Blat" in combination with xp_cmdshell I've used all three, and all three work well. GB wrote: Show quoteHide quote > Hello: > In SQL Server 2000 database I have a table MyTable which is updated daily > with previous day data. In some reason data could be missing for particular > day. To control the situation I'd like to create alert message to be sent to > me by e-mail. > The verification SQL statement is: > IF (select DATEDIFF ( day , max(datadate) , GetDate() )from MyTable) >1 > print 'ALERT!' > > How can I get the verification result by e-mail? > > Thanks, > GB Thank you, xp_sendmail is working OK.
GB Show quoteHide quote "Tracy McKibben" <tracy.mckib***@gmail.com> wrote in message news:1149797645.683037.46670@i39g2000cwa.googlegroups.com... > There are generally three ways to send email from SQL 2000: > > 1. Install Outlook on the server and configure SQL Mail. You can then > use xp_sendmail to send emails. > > 2. Use xp_smtp_sendmail: http://www.sqldev.net/xp/xpsmtp.htm > > 3. Use a command-line mailer such as "Blat" in combination with > xp_cmdshell > > I've used all three, and all three work well. > > > GB wrote: > > Hello: > > In SQL Server 2000 database I have a table MyTable which is updated daily > > with previous day data. In some reason data could be missing for particular > > day. To control the situation I'd like to create alert message to be sent to > > me by e-mail. > > The verification SQL statement is: > > IF (select DATEDIFF ( day , max(datadate) , GetDate() )from MyTable) >1 > > print 'ALERT!' > > > > How can I get the verification result by e-mail? > > > > Thanks, > > GB >
Other interesting topics
Default constraints in SQL Server 2000
How to construct a like compariso when there are special characts Procedure/cursor question about returning results Using FileCopy to Copy Files via T-SQL Simple distributed transaction example does not work Calculated columns... log shipping How to Move Sql2000 DTS into Sql2005 legacy folder How to generate a table script in T-SQL? How to generate reports !!! some basic question |
|||||||||||||||||||||||