Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to send HTML format mail in SQL Server

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

In this issue, the editor will bring you about how to send HTML email in SQL Server. The article is rich in content and analyzed and described from a professional point of view. I hope you can get something after reading this article.

The reference code is as follows:

DECLARE @ tableHTML NVARCHAR (MAX);-- get the current system time and set @ d_nowdate = convert (datetime,convert (varchar (10), dateadd (day,-1,getdate ()), 120) -- if you have data, send if exists (select top 1 * from t_table1 (nolock) where d_rq=@d_nowdate) begin set @ str_subject=''+ convert (varchar (10), @ dazzle now date 120) + 'net worth.'; SET @ tableHTML = N'xx.

Currently in testing

'+ N' date Fund Code Cumulative net value of Fund name' + CAST ((select convert (varchar (10), @ dancnowdate120) as' td','',VC_JJDM as' td','',Vc_jjmc as' td','',EN_JJDWJZ as' td','' EN_LJJZ as' td' from t_table1 t left join t_table2 tt on t.VC_JJDM = tt.C_FUNDCODE where d_rq=@d_nowdate order by Vc_jjmc,VC_JJDM FOR XML PATH ('tr'), ELEMENTS-- TYPE) AS NVARCHAR (MAX)) + nasty' -- send exec @ i_result = msdb.dbo.sp_send_dbmail @ profile_name = 'Profile-Mail', @ recipients =' email address 1; mailbox 2; mailbox 3, @ subject = @ str_subject, @ body = @ tableHTML, @ body_format = 'HTML'; end

The effect of the message is as follows:

So-and-so net worth

Currently in testing

Date

Fund code

Name of the fund

Net worth

Cumulative net worth

2013-12-20

111111

AAAAA

0.98300000

0.98300000

2013-12-20

222222

BBBBB

1.04900000

1.04900000

2013-12-20

333333

CCCCC

0.64000000

0.64000000

2013-12-20

444444

DDDDD

0.99400000

0.99400000

2013-12-20

555555

EEEEE

1.05700000

1.05700000

2013-12-20

666666

FFFFF

0.73400000

0.73400000

This is how to send HTML email in SQL Server shared by Xiaobian. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report