Inserting Image to HTML table within SQL Server stored procedure for use with DBMail -
i want add icon/image within column of table populated sql server table data & resulting emailed out.
as stands i'm getting in email
<img src="cid:redtl.gif"/> my code:
--full path set within attachments @file_attachments='e:\redtl.gif', set @tblhtml= n'<style type="text/css">' + n'.table { background-color:#d8e7fb;border-collapse:separate;color:#000;font-size:18px; }' + n'.table th { background-color:#0e0355;color:white; }' + n'.table td, .table th { padding:5px;border:0; }' + n'.table td { border: 1px dotted white; }' + n'</style>' + n'<table class="table">' + n'<th><font face="calibri" size="2">column1</th>' + n'<th><font face="calibri" size="2">image column</font></th>' + n'<th><font face="calibri" size="2">column3</font></th>' + n'<th><font face="calibri" size="2">column4</font></th>' + n'<th><font face="calibri" size="2">column5</font></th>' + n'<th><font face="calibri" size="2">column6</font></th>' + cast ( ( select td=[column1],'', --filename referenced td='<img src="redtl.gif"/>','', td=[column2],'', td=[column3],'', td=[column4],'', td=[column5],'' [table1] order [column1] xml path('tr'), type ) nvarchar(max) ) + n'</table>' i have other images embedded fine, having issues embedding 1 within table.
the email viewed within outlook & won't leave internal network.
any pointers superb!
thanks
hopefully might of use @ point in time..... working cast column xml within table select, '' set against each row within temp table differed depending on date, pretty straightforward;
set @tblhtml= n'<style type="text/css">' + n'.table { background-color:#d8e7fb;border-collapse:separate;color:#000;font-size:18px; }' + n'.table th { background-color:#0e0355;color:white; }' + n'.table td, .table th { padding:5px;border:0; }' + n'.table td { border: 1px dotted white; }' + n'</style>' + n'<table class="table">' + n'<th><font face="calibri" size="2">case attorney</th>' + n'<th><font face="calibri" size="2">tl status</font></th>' + n'<th><font face="calibri" size="2">event due date</font></th>' + n'<th><font face="calibri" size="2">event description</font></th>' + n'<th><font face="calibri" size="2">event no.</font></th>' + n'<th><font face="calibri" size="2">client</font></th>' + n'<th><font face="calibri" size="2">applicant</font></th>' + cast ( ( select td=[caseatt],'', td=cast([tlimage] xml),'', td=convert(varchar(12),[eventduedate],103),'', td=[eventdesc],'', td=[eventno.],'', td=[client],'', td=[applicant],'' #tlrep order [caseatt] xml path('tr'), type ) nvarchar(max) ) + n'</table>' to point out supposed dupe question post/comment (very) wide of asking.
Comments
Post a Comment