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 2005 Forums
 Other SQL Server Topics (2005)
 Notification Service

Author  Topic 

waja
Starting Member

6 Posts

Posted - 2010-07-05 : 03:22:26
Hi,

Is there a very simple way to setup a very simple notification routine like below:

1. Everyday at a specific time
2. Query one of my database table (count total record inside table)
3. send out above result to an email address.

Remarks:
I'm using SQL server 2005 with windows server 2003.

Thank you very much in advance.

kind regards

waja

beniaminus
Starting Member

21 Posts

Posted - 2010-07-05 : 07:48:46
You could set up a new Maintenance Plan to execute a T-SQL script.

In the script you would have to query the table and send the result using database mail. I think it uses an sp called sp_send_dbmail.

You can find some info on database mail here: [url]http://msdn.microsoft.com/en-us/library/ms175887.aspx[/url]

I hope this helps

Ben :)
Go to Top of Page

waja
Starting Member

6 Posts

Posted - 2010-07-05 : 18:22:07
Hi,

Thank you very much for your help. will try out the method proposed by you.

Kind regards.

waja
Go to Top of Page

waja
Starting Member

6 Posts

Posted - 2010-07-13 : 06:10:50
I try to create a maintenance plan and select 'email report' as report option. When i click on the email button, nothing happened....an error message appeared at the bottom window.

There are no operators defined on the system

Can someone please advise.

Kind regards.



waja
Go to Top of Page

rdjabarov
Starting Member

8 Posts

Posted - 2010-07-13 : 12:11:58
you need to set up an operator, and specify valid email address. You can be the oprator, or a specific distribution list, with just you in it. Then you can simply set up a scheduled task of T-SQL subsystem, where you would store the results of COUNT(*) operation into a variable, and then send as elaborate of a message to yourself as you want using sp_send_dbmail.

"The data in a record depends on the Key to the record, the Whole Key, and nothing but the Key, so help me Codd."
Go to Top of Page

waja
Starting Member

6 Posts

Posted - 2010-07-13 : 12:22:08
Hi,

Thanks for your help. so how and where do i setup this operator?

Kind regards,

waja
Go to Top of Page
   

- Advertisement -