Creating Multiple lines using msdb..sp_send_dbmail

Posted on 2007-09-28
Last Modified: 2010-05-18
This is a sample of my e-mail creattion. However, I have to add more information which I would like to have presented on another line so it looks nice and in a readable format when the email is sent.  How do I format and e-mail with multiple lines and format it to position cetain data on certain lines?  The bodyStr is just a varcahr of 4000 bytes so it will just wrap and not look presentable???

set @monthEnding = CONVERT(varchar,@ToDate,101)
Set @bodyStr = 'MOSS identified closed issues totaling $' + @eGRNDAmountTotal + ' for month ending ' + @monthEnding

exec msdb..sp_send_dbmail
      --      @profile_name = 'Mail Test',
            @profile_name = 'DBMAIL',
               @recipients = '',
            @body = @bodyStr,
            @Subject = 'Report:  MOSS Executive Monthly Report.'
My e-mail format I would like to have is as follows

Our Group identified and closed issues totaling $________ for the month of___________

·        Regional Billing total invoices affected _________________  totaling to  $__________
·        ATT Render Billing total invoices affected_______________  totaling to $___________


Question by:dm3295
    1 Comment
    LVL 5

    Accepted Solution

    if you are sending plain text try adding char(10)+chr(13) for new lines (or only chr(10) for some encodings)

    if you sending html data, then insert <BR>

    Featured Post

    PRTG Network Monitor: Intuitive Network Monitoring

    Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

    Join & Write a Comment

    Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
    Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now