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
 General SQL Server Forums
 New to SQL Server Programming
 how to send email

Author  Topic 

shan1430
Yak Posting Veteran

86 Posts

Posted - 2008-03-27 : 22:17:35
Hi,
I need to select a table from my database and send the table as an email message to a person every 10am because the table changes every day. How to it?

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-03-27 : 22:56:48
Check xp_sendmail in BOL
Go to Top of Page

shan1430
Yak Posting Veteran

86 Posts

Posted - 2008-03-27 : 23:48:49
Hi, i used the following to test the query and i didnt receive the email. Can help?

CREATE PROCEDURE dbo.foo AS
BEGIN
SET NOCOUNT ON
-- do some other actions
DECLARE @body VARCHAR(1024)
SET @body = 'foo was fired '+
CONVERT(VARCHAR, GETDATE())

EXEC master..xp_sendmail
@recipients='shan1430@hotmail.com,
@message = @body,
@subject = 'foo was fired.'
END
Go to Top of Page
   

- Advertisement -