关于SQL数据库 msdb.dbo.sp_send_dbmail 函数发送邮件的场景分析

2020-07-06 05:54:50易采站长站整理

+'<td align="center">'+Competitor_Price+'</td></tr>'
from
(
select
email
,note
,rfq_quotation_number
,lastname
,pl3
,客户中文+'/'+客户英文 as customer
,disty_name
,snd_disty
,sold_to_customer
,fully_part_no
,currency
,isnull(cast(volume as nvarchar(10)),'') volume
,isnull(cast(requested_disty_cost as varchar(10)),'') requested_disty_cost
,isnull(cast(cust_requested_price as varchar(10)),'') as cust_requested_price
,isnull(cast(competitor as varchar(100)),'') competitor
,isnull(cast(competitor_part_no as varchar(50)),'') competitor_part_no
,isnull(cast(competitor_price as varchar(10)),'') competitor_price
from cux_rfq_v
where currentnodetype = 1 and lastoperatedate + ' '+ lastoperatetime >= DATEADD(MINUTE,-60,GETDATE()) --找最近60分的记录,并发送
) a
open c
fetch next from c into
@mail
,@note
,@tableHTML;
while @@FETCH_STATUS = 0
begin
EXEC msdb.dbo.sp_send_dbmail
@profile_name= '<账户名>', --定义好的sql server 邮箱账户名
,@recipients=@mail
,@subject=@note
,@body= @tableHTML
,@body_format='HTML'
fetch next from c into
@mail
,@note
,@tableHTML;
end
close c;
deallocate c;

总结

以上所述是小编给大家介绍的关于SQL数据库 msdb.dbo.sp_send_dbmail 函数发送邮件的场景分析,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对软件开发网网站的支持!

相关文章 大家在看