DEV Community

AndySqlman
AndySqlman

Posted on

How to display an SQL query result in email body

Reposted from: https://www.sqlmessenger.com/faqview.html?id=557

Q: I have the following result from an SQL query, and I would like to find an easy way to display this table in the body of an email I send. Could you please help me with this?

Image description

A: Certainly! You may insert the SQL query result table into the body of the email by following these steps.

Step 1: Right-click the location in the body template where you want to insert the table, then click the "Insert SQL Table" menu item.

Image description

Step 2: Enter your SQL statement then click "Next".

Image description
Tip: The system will then run the SQL statement you entered and obtain the field information returned by the SQL statement.

Step 3: Select the fields you want to display in the table from the list on the left, and add them to the list on the right.

Image description

Step 4: Set the style of the table, such as cell color, font, and column width.

Image description

You can double-click a cell to set the column name and display options for the column.

Image description

After completing the wizard, the system will display a table icon in the body template. You can double-click this icon to modify the content of the table.

Image description

After the task runs, the system will execute the SQL statement you entered and convert the query results into a table displayed in the body.

Image description

Tip: You can place multiple tables like this in the email body.

Top comments (0)