Formatting Email Query Data

  • I'm running a query via sp_send_dbmail. In Outlook, it would show up in Courier, so all the columns lined up. Nice & plain & simple. We're moving to Outlook 2010, and now it comes through in a different font which is proportional, so data doesn't line up any more. Maybe I could make a setting change in my own Outlook account, but that won't help the emails being sent to others.

    Is there a way in my SQL query (or somewhere else) to force the data to appear in Courier or equivalent ?. Or some better way to send query results to others in a quickly readable form ?

  • If you're looking for columns and rows, you can use FOR XML to format it into an HTML table. Microsoft has an example of that on MSDN if you look up sp_send_dbmail. Easy to set up and looks great.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Looks like what I need ... Thanks !

  • You're welcome.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply