Enter SQL Statement



NOTE: If you haven't already, you must first complete the "Select A Database" section within this help file before proceeding.

In order for BounceStudio to log to your database, you must enter the SQL statement that BounceStudio will execute each time it retrieves/reads a bounced message from your monitored items.


Using BounceStudio Variables

One important concept to remember when creating your SQL statement is the idea of BounceStudio variables. A BounceStudio Variable is a data value that can be used anywhere in your SQL statement. They are most commonly used in the VALUES clause of an INSERT statement, the SET clause of an UPDATE statement, or as parameter values for a SQL stored procedure.

For an explanation and list of available BounceStudio variables, click HERE.


Example SQL Statements

The best way to illustrate writing SQL statements using BounceStudio variables is to show you a couple of examples.


EXAMPLE 1 - INSERT Statement

An INSERT statement appends new rows to a table. For this example, let's assume you have a Microsoft Access database with a table called "BounceLog". The "BounceLog" table is where you wish to log, using an INSERT statement, your bounced email addresses to. Your "BounceLog" table contains the following fields:


Field NameField Data TypeBounceStudio Variable Mapping
BounceTypeTEXT (4 chars)#BOUNCETYPE#
EmailAddressTEXT (255 chars)#EMAIL#
AccountNameTEXT (25 chars)#MONITOREDITEM#
For a complete list of available BounceStudio variables, click HERE.



In order for BounceStudio to log to your "BounceLog" table, your SQL statement would need to look like the following:


SQL Statement
INSERT INTO BounceLog (AccountName, EmailAddress, BounceType)
VALUES ('#MONITOREDITEM#', '#EMAIL#', '#BOUNCETYPE#')



Sample BounceStudio SQL Statement: INSERT statement




EXAMPLE 2 - Stored Procedure

Some database systems allow you to use something called a stored procedure. Examples of such database systems include Microsoft Sql Server, Oracle, and MySQL to name a few. BounceStudio has the capability of executing these stored procedures in the same way that it can directly execute an INSERT statement, or UPDATE statement.

The following is a SQL statement illustrating the use of a stored procedure in BounceStudio:

SQL Statement
spInsertLog @sAccountName='#MONITOREDITEM#', @sEmailAddress='#EMAIL#', @sBounceType='#BOUNCETYPE#'
For a complete list of available BounceStudio variables, click here.





Sample BounceStudio SQL Statement: Stored Procedure