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
 Transact-SQL (2000)
 emailing values from procedure at an specific time

Author  Topic 

AsimKhaliq
Yak Posting Veteran

94 Posts

Posted - 2004-04-14 : 18:47:41
Hi
I want to write a procedure which get some value from my query and send an eamil at an specific time. So lets suppose I have total orders and total shiped values and wanna email these values. can some one help me.

Thanks in advance
Asim

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-04-14 : 18:51:39
Have you configured SQL Mail? If so, you can use xp_sendmail.

Tara
Go to Top of Page

AsimKhaliq
Yak Posting Veteran

94 Posts

Posted - 2004-04-14 : 19:04:37
Thnx Tara
I am looking at those things but can u tell me how to schedule it, can i have a refrence example for this.
Thnx again
Asim
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-04-14 : 21:31:09
In Enterprise Manger, you need to expand Management...SQL Agent...Jobs. You will need to add a job by right-clicking on the job and clicking on "New Job". YOu then need to set it up to run under an account that has permission to use xp_sendmail (such as the sa account) by choosing a proper owner. On the Steps tab, you need to add a job step that has the following:

EXEC master..xp_sendmail 'email1@yahooz.com;email2@yahooz.com','Put a Title Here','EXEC database.owner.StoredProcedure'
GO

You can then schedule the job to run whenever you please.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

AsimKhaliq
Yak Posting Veteran

94 Posts

Posted - 2004-04-15 : 08:41:53
Thnx
I have one problem when iam selecting the profile from sqlmail and run test it gives me an error.Although my mail from out look is working perfect. can someone help me regarding mail profile

Thanks
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-04-15 : 12:12:24
http://support.microsoft.com/default.aspx?scid=kb;EN-US;263556

Tara
Go to Top of Page
   

- Advertisement -