INSERT

Adds new DataRows to a DataTable. It is similar to the EXEC SQL INSERT statement which adds new rows into a SQL table.

Syntax:

>>--EXEC ADO--.--------------------.--.-----------------.---->
              +-USING dataset_name-+  +-FOR :host_integer-+


 >--INSERT INTO datatable_name--.---------------.------------>
                                |               |
                                |  +--- , ---+  |
                                |  V         |  | 
                                +-(column_name)-+

            +---------- , ---------+  
            V                      |
 >--VALUES (.----------------------.)---END-EXEC-------------><
            +-- :column_value_hv --+
            +-- column_value     --+

Parameters:

dataset_name The DataSet reference to be used. If you do not specify dataset_name, the current DataSet is used.
:host_integer A host variable that specifies the maximum number of host array elements processed. Must be declared as PIC S9(4) COMP-5 or PIC S9(9) COMP-5.
datatable_name The DataTable that will receive the new DataRows.
column_name A column in the DataTable.
:column_value_hv The corresponding column value for column_name.
column_value The corresponding literal column value for column_name.

Comment:

After execution, SQLERRD(3) contains the number of elements processed. For INSERT it is the total number of rows inserted.

Example:

     EXEC ADO 
        INSERT INTO Customers 
        (CustomerID, CompanyName, ContactName)
        VALUES ('ZZZZ2', 'Java Jugglers', 'Mike Smith')
     END-EXEC