Adding Image on to send email thru SQL
I am trying to send a simple HTML email thru SQL stored procedure. Is it possible adding a image such as company logo for the email result?
This is a part of stored procedure.
/*Create HTML*/
SET @TableHTML =
N'<H4>Production Alert (' + CONVERT(VARCHAR(10),GETDATE(),101) + ')</H4>' 开发者_运维问答+
N'<table border="1">' +
N'<tr>' +
N' <td>Company</td>' +
N' <td width="70" align="CENTER">Department</td>' +
N' <td width="70" align="CENTER">Target</td>' +
N' <td width="70" align="CENTER">Shipped</td>' +
N' <td width="70" align="CENTER">Achievement by Yesterday</td>' +
N' <td width="70" align="CENTER">Achievement for this month</td>' +
N' <td width="70" align="CENTER">Difference</td>' +
N' <td width="70" align="CENTER">Catch Up QTY</td>' +
N'</tr>' +
CAST ( ( SELECT td = a.CompanyName, '', 'Right' AS "td/@align",
td = DepartmentName, '', 'Left' AS "td/@align",
td = ForecastQtyAcc, '', 'Right' AS "td/@align",
td = ShippedQtyAcc, '', 'Right' AS "td/@align",
td = ThePercentage, '', 'Right' AS "td/@align",
td = ThePercentageAll, '', 'Right' AS "td/@align",
td = TheDiff, '', 'Right' AS "td/@align",
td = CatchUpQTY, ''
FROM #Monthdata a
FOR XML PATH('tr'), TYPE
) AS NVARCHAR(MAX) ) +
N'</table>' ;
DROP TABLE #Monthdata
/Email it/ SET @TableHTML = @TableHTML + N'' + N''
See: Embed Images in emails created using SQL Server Database Mail
精彩评论