I'm creating an email alert that will most likely be routed to smart phones (either email or SMS) and be used to wake people up when we have production issues. Email is send with EXEC msdb.dbo.sp_send_dbmail and providing the @query parameter which executes a stored proc.
Currently, the report looks something like this, and as you can see, when things wrap around and are not in a Courier font, they look horrible.
What is the best way to format this? HTML emails instead with a table? Are there any T-SQL utilities to do that? Is this perhaps a job for C# instead of T-SQL (I can code either).
> Rating Airline Feed LocalDateTimeLastMsgRcvd > AlertMinutes CountMessageInLastHour AvgCountPerSameHour > ---------- ---------- ---------------- ------------------------ ------------ ---------------------- ------------------- GOOD ABC Feed1 2012-08-22 07:15 10 > 420 351 BAD ABC ABC-Feed2 > 2012-08-22 07:04 10 48 > 56 GOOD ABC ABC-Feed3 2012-08-22 06:40 > 75 1 1 GOOD DEF > DEF 2012-08-22 07:15 10 > 597 858
I am considering three ideas:
1) Use T-SQL to write each element on different line of temp table:
Row=1
Rating=Good
Feed=ABC
LocalDateTimeLastMsgRcvd=2012-08-22 07:04
etc..
.
2) Similar to above but use XML wrappers
3) Similar to above but use <TR><TD>
wrappers to make HTML table.
I'm currently looking at option c here: http://msdn.microsoft.com/en-us/library/ms190307.aspx, which will probably work for most smartphone emails, but probably not SMS. Some people will forward this to their SMS.