August 24, 2014 at 2:16 am
I have belwo codes which i want to convert to variable email IDs using same table.
can some one help?
use
db
go
DECLARE @tableHTML NVARCHAR(MAX) ;
SET @tableHTML =
N'<H2>Dear User(USD)</H2>' +
N'<table border="1">' +
N'<tr><th>Column1</th><th>Column2</th>' +
CAST ( ( SELECT td = [Column1],'',
td = [Column2], ''
FROM dbo.table1
FOR XML PATH('tr'), TYPE
) AS NVARCHAR(MAX) ) +
N'</table>'
+N'
Regards,</br>' +
+ N'XX'
EXEC msdb.dbo.sp_send_dbmail @recipients='user@mail.com',
@subject = 'Subject Line',
@profile_name = 'MyProfile',
@body = @tableHTML,
@body_format = 'HTML' ;
August 24, 2014 at 3:24 am
It worked for me. I sorted out by myself.
August 24, 2014 at 3:31 am
please don't cross post. Original post: link
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply