October 2, 2008 at 10:08 am
October 2, 2008 at 10:13 am
What version of SQL Server is this for? How do you want the contents of the table sent, as a CSV attachment, inline to the body of the message, as a HTML message? More information is needed to provide a real solution to your question. In SQL 2005/2008 use database mail, in SQL 2000, it is a bit more involved.
Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
My Blog | Twitter | MVP Profile
Training | Consulting | Become a SQLskills Insider
Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]
October 2, 2008 at 10:14 am
From within the database, you can use Database Mail (SQL2005) or SQL Mail (SQL2000). For SQL2005, there's a good article here:
http://www.sql-server-performance.com/articles/dba/email_functionality_p4.aspx
From an external application such as ASP.net, you might use something like CDO NTS (or a third party component)
October 2, 2008 at 10:42 am
2005 sql server version
October 3, 2008 at 1:21 pm
what kind of data you want to send, i have a full document for this point ( send email by database mail ) via procedure, what i have now to save data to table and send record by record via mail
October 3, 2008 at 1:25 pm
I want to send data from the view. Thank you so much
October 5, 2008 at 12:43 am
check the following example i used it and it works fine but dont forget to enable ( database mail )
------------
DECLARE @tableHTML NVARCHAR(MAX) ;
SET @tableHTML =
N' ' +
N' ' +
N' ' +
N' ' +
N' '+
CAST ( ( SELECT td = Customer_Code, '',
td = Customer_Name, '',
td = City, ''
FROM [customer].[dbo].customer
WHERE customer_code = 121494
FOR XML PATH('tr'), TYPE
) AS NVARCHAR(MAX) ) +
N' ' ;
EXEC MSDB.dbo.sp_send_dbmail
@profile_name = 'HelpDesk',
@recipients = 'ikrami2000@hotmail.com' ,
@subject = 'Subject text',
@body = @tableHTML,
@body_format = 'HTML' ;
------------
October 5, 2008 at 12:44 am
DECLARE @tableHTML NVARCHAR(MAX) ;
SET @tableHTML =
N' ' +
N' ' +
N' ' +
N' ' +
N' '+
CAST ( ( SELECT td = Customer_Code, '',
td = Customer_Name, '',
td = City, ''
FROM [customer].[dbo].customer
WHERE customer_code = 121494
FOR XML PATH('tr'), TYPE
) AS NVARCHAR(MAX) ) +
N' ' ;
EXEC MSDB.dbo.sp_send_dbmail
@profile_name = 'HelpDesk',
@recipients = 'ikrami2000@hotmail.com' ,
@subject = 'Subject text',
@body = @tableHTML,
@body_format = 'HTML' ;
October 6, 2008 at 5:41 am
Thank you so much
October 6, 2008 at 5:51 am
ikrami2000 (10/5/2008)
DECLARE @tableHTML NVARCHAR(MAX) ;SET @tableHTML =
N' ' +
N' ' +
N' ' +
N' ' +
N' '+
CAST ( ( SELECT td = Customer_Code, '',
td = Customer_Name, '',
td = City, ''
FROM [customer].[dbo].customer
WHERE customer_code = 121494
FOR XML PATH('tr'), TYPE
) AS NVARCHAR(MAX) ) +
N' ' ;
EXEC MSDB.dbo.sp_send_dbmail
@profile_name = 'HelpDesk',
@recipients = 'ikrami2000@hotmail.com' ,
@subject = 'Subject text',
@body = @tableHTML,
@body_format = 'HTML' ;
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply