Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Help send query in HTML

$
0
0

So I have the below sql job that is send me the information but in a non readable format. I would like to make this an HTML email. Can you please help me.

I have try to reproduce http://www.wikihow.com/Send-a-Scheduled-HTML-Report-Directly-from-SQL-Server, but keep getting errors.

declare @query nvarchar(max)

set @query=
'use fascinhq select * from store where ID not in (
Select distinct ws.StoreID from worksheet as w
JOIN worksheetstore ws on w.id = ws.worksheetid
WHERE w.style = ''401'' and w.fromdate >= dateadd(hh, -6, GETDATE())
    and w.Status in (3,4,7)            )
and ID <> 4 '

EXEC msdb.dbo.sp_send_dbmail
@profile_name= 'MyMailProfile',
@recipients= '(My Email)',
@subject='RMSGP',
@query= @query

Thank you for the Help.

 Brian


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>