Table of Contents

Search

  1. Preface
  2. Introduction
  3. Dashboard
  4. Resources
  5. Workflows
  6. Task Reference
  7. Services Overview
  8. Users
  9. Logs and Reports
  10. Encryption
  11. System
  12. Appendix
  13. Glossary Terms

Example 3: SQL INSERT Using Query Parameters

Example 3: SQL INSERT Using Query Parameters

In the previous example, the entire 'myData' RowSet variable was inserted into a SQL database. On some occasions, you may only want to add selected columns from the RowSet variable into the database. To add specific columns, you must use a Parameter element for each column you wish to insert.
Follow the steps below to insert columns one and six from the 'myData' RowSet variable into the database.
  1. From within the Project Designer page, expand the Database folder in the Component Library, and then drag the SQL task to the Project Outline.
  2. On the Basic tab of the SQL task, select the database server resource from the drop-down list. If not already defined, click the
    Create
    button to define a new database server resource.
  3. Click the
    Add
    button to Add a Query to the SQL task.
  4. Type in your SQL Insert Statement on the page. In this example, only two placeholder '?' are used for the Indexes referenced in the 'myData' RowSet.
  5. Specify the RowSet variable name '${myData}' into the Input RowSet Variable field. The specified SQL Statement will be executed once per each row in this RowSet.
  6. Click the
    Add
    button to Add a Parameter to the SQL query.
  7. Enter '1' in the Parameter Index field. The '1' represents the first '?' placeholder position in the SQL Statement.
  8. Enter '1' in the Map From field. This inserts data from column 1 of the 'myData' RowSet variable into the first column of the database.
  9. Click the
    Add
    button and choose Add Same to add another Parameter to the SQL query.
  10. Enter '2' in the Parameter Index field. The '2' represents the second '?' placeholder in the SQL Statement.
  11. Enter '6' in the Map From field. This inserts data from column 6 of the 'myData' RowSet variable into the database.
  12. Click the
    Save
    button when complete. When the Project is executed, data from columns 1 and 6 from the 'myData' RowSet variable are inserted into the SQL Database.
    The following image illustrates the Project Outline for the SQL Query INSERT task which uses two Query Parameter elements:

0 COMMENTS

We’d like to hear from you!