SQL Server Central is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 

Send query result as HTML Mail

By EYER Daniel, 2008/05/12

Total article views: 1683 | Views in the last 30 days: 173

Tested on SQL Server 2000.
This script use CDOSys to send a mail. No mapi profile required.

The query result is send as html body

Limitation: the result of the query does not have to exceed 8000 characters.

Thanks to Raja Mohamed for the query to html code.

 

Exemple

exec sp_send_MailHtml
'smtp.fr.oleane.com' --SMTP Server
'YourEmail@sql.com', --From
'daniel.eyer@free.fr', --To
'daniel.eyer@wanadoo.fr', --CC
'', --CCi
'List of USA Customers', --Subject
'select * from dbo.Customers Where Country = ''USA'''

By EYER Daniel, 2008/05/12

Total article views: 1683 | Views in the last 30 days: 173
Your response
 
 
Related tags

cdosys     Mail    
HTML     query    
 
Related content

SQL Mail Stop and Start

By sy183737 | Category: Mail
| 601 reads
Like this? Try these...

Get dependant Objects

By Abhijit . | Category: T-SQL
(not yet rated) | 594 reads

Tic Tac Toe TSQL Style

By adam haines | Category: TSQL
| 1,152 reads

Move Physical Files

By Jorge Novo | Category: Maintenance
| 711 reads
Already registered?  

Free registration required

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Register

E-mail address:
Password:
Password (confirm):

  

Subscriptions

We ask you to register on the site and subscribe to our newsletters. Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

We ask that you give the newsletter a try for a week. Over 200,000 SQL Server Professionals a day find it entertaining and useful. If not, you are welcome to unsubscribe at anytime.

Steve Jones
Editor, SQLServerCentral.com