Creating a Query with the E-mail Interface

You can create and run an SQL query using the DB2 Web Query Tool e-mail interface. Before you can use the e-mail interface, your system administrator must authorize you as an e-mail user for the database that you want to access.

To create a query using the e-mail interface:

1.         E-mail DB2 Web Query Tool at the database that you want to access.

DB2 Web Query Tool replies with the subject "DB2 Web Query Tool SMTP Server".

2.         Reply to the e-mail. Between the { }, following "cmd" at the end of the e-mail, type "help", then send the reply. For example: cmd {help}

DB2 Web Query Tool replies with an e-mail containing a list of possible commands.

3.         Reply to the e-mail. Between the { } following "cmd" at the end of the e-mail, type "run sql". For example: cmd {run sql}

4.          Optional: type a format preference, such as "format:html", and a row limit, such as "rowlimit:50". You can also specify an alternate e-mail address to send the query results to, such as "e-mail:you@youraddress.com".

5.         Type the SQL statement that you want to run.

For example, if you want to view all rows from the table GROUP.TABLE, e-mail the results to you@youraddress.com, and view the results in html format, the last line in your reply might look like this:

cmd {run sql format:html e-mail:you@youraddress.com SELECT * FROM GROUP.TABLE}

6.         Send the reply.

DB2 Web Query Tool runs the query and returns the results according to your specifications.

Related information

Commands that can be used to access DB2 Web Query Tool via e-mail