Saturday, March 26, 2016

Build HTML Email from SQL Table content.


There was a need to create HTML table email body from the contents in the SQL table.

Here is the code snippet to do it.
 
 
Set @body = select
                                         AgencyID AS [TD]
                                    , Name AS [TD]
                                    , IsClient AS [TD]
                           from data.Agencies
                           For XML raw('tr'), Elements
 
I must give credit for the following site which provided this idea and good explanation.
 
 
Happy Coding.
 
Cheers
Adam
 
 

No comments:

Post a Comment

All Blogs so far ...