Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Send an Email with a table witin init formatted using HTML

Status
Not open for further replies.

DebugMode

Programmer
Sep 29, 2011
1
GB
Hi
I was just wanting some help. My task is to taker the results of a query from SQL Server 2005 and then write these results into my email which is then going to send to a set email list.

I belive I need to use a script task but not sure how to transpose the results into the HTML body.

Any help appreciated
 
Just use sp_send_dbmail which will automatically attach the output of a query to the email. The output can either be an attachment or it can be the subject of the email.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / SQL 2005 BI / SQL 2008 DBA / SQL 2008 DBD / SQL 2008 BI / MWSS 3.0: Configuration / MOSS 2007: Configuration)
MCITP (SQL 2005 DBA / SQL 2008 DBA / SQL 2005 DBD / SQL 2008 DBD / SQL 2005 BI / SQL 2008 BI)
MCM (SQL 2008)
MVP

My Site
 
TO add to MrDenny's comments...just look up sp_send_dbmail in the Books OnLine for SQL Server and you'll see the different options available, one of which is to run a query and attach the results.

-SQLBill

The following is part of my signature block and is only intended to be informational.
Posting advice: FAQ481-4875
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top