Using sp_send_dbmail , the data in sql server can be sent in HTML format.
Eg:
I have a HTML file in the follwing format
and is saved as web.htm in a network location.
Here is the TSQL script that will send an email to a recipient in the HTML format using web.htm
---------------
declare @cmdshell varchar(1000)
if exists(select * from #cmdtable)
drop table #cmdtable
create table #CMDTABLE(line varchar(2000))
insert into #cmdtable
exec xp_cmdshell 'type "\\Your Network Share\web.htm" '
select @cmdshell = line from #CMDTABLE
exec msdb.dbo.sp_send_dbmail
@recipients = 'your email address'
,@body = @cmdshell
,@body_format = 'HTML'
,@subject = 'Testing with web.txt'
can use the same stuff for attaching a picture on the HTML page
1 comment:
Well written article.
Post a Comment