sqlyog自动电子邮件警报

时间:2019-08-08 02:55:29

标签: mysql email alert

我需要生成自动电子邮件警报,其中 -查询应在MySQL中(就绪) -如何将其嵌入HTML并建立连接(不知道)

我对SQL Server做过同样的事情,但我对MySql一无所知。 这是我所做的SQL代码。


declare @tableHTML NVARCHAR(MAX),@s1 varchar (max), @s2 varchar (max) , 
@s3 varchar (max);
set @s1 = 'Sales Data Of All Stores Of CN and HK '
set @s2 = (convert(varchar, getdate()-1, 107))

set @tableHTML = '<H1>Sales Data Of All Stores Of CN and HK </H1>
<table border="1" cellpadding="10">
<style>
table,th,td
{
border="5" bordercolor="#ff0000";
}
table
{
BORDER=10 BORDERCOLOR="#0000FF" BORDERCOLORLIGHT="#33CCFF" 
BORDERCOLORDARK="#0000CC"
}
td
{
height:40px;
}
tr
{
background-color:green;
color:white;
}
th
{
background-color:yellow;
color:black;
}
</style>
<tr>
<th>S.NO.</th>
<th>STORE NO.</th>
<th>BUSINESS DATE</th>
<th>TOTAL NO. OF TRANSACTIONS </th>
<th>TOTAL NO. OF RETURNS </th>
<th>TOTAL NO. OF BILL CANCELLATIONS</th>
<th>TOTAL AMOUNT</th>
</tr>' + 
CAST ( ( 
select *
FROM XYZ
WHERE X=Y
GROUP BY X 
FOR XML PATH('tr'), TYPE ) AS NVARCHAR(MAX) )+'</table>';
--Print @tableHTML;
set @s3 = @s1 + @s2
exec msdb.dbo.sp_send_dbmail 
@recipients=''
, @profile_name=''
, @subject= @s3
, @body = @tableHTML
, @body_format = 'HTML' 

我需要使用SQLYog为Mysql提供相同的结果。请帮我 这个。

0 个答案:

没有答案
相关问题