sp_send_dbmail HTML

Posted on 2008-11-03
Last Modified: 2012-05-05
I have a view that I would like to select about ten fields from and put into an email.  I need to send my email in html format to the persons email that is located on the same table/line in a field called email, but can't get the format right.
In the view, I have fields like name, email, q1,q1ext,q2,q2ext,q3,q3ext,q4,q4ext  I would like to select these fields from the view and display them like the following:
How can this be done?

q1        q1ext
q2        q2ext
q3        q3ext
q4        q4ext
Question by:H-SC
    LVL 25

    Accepted Solution

    LVL 1

    Author Comment


    What would the code look like for just html in the body of the email ?
    LVL 1

    Author Comment


    just wanted to follow up.. any ideas?
    LVL 25

    Expert Comment

    I think the the example is clear enough.  
    1.  know how your output (HTML) must be -> example of a table in the accepted sollution
    2.  how to build html-string: -> shown in example even with the cursor-example to make the tablerows

    I share kindly the how to ... but I hate typing code that I can't test (and it feels like free labor to me)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
    Introduction In my previous article ( I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
    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…
    Viewers will learn how the fundamental information of how to create a table.

    758 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

    11 Experts available now in Live!

    Get 1:1 Help Now