DECLARE DATATABLE

Defines an ADO.NET DataTable.

Syntax:

>>--EXEC ADO---DECLARE datatable_name DATATABLE---------------------->

 >-------------( table_item_list )---------------------END-EXEC------><

where

table_item_list:

      +------------------   ,   ----------------------+
      V                                               |
 >-.--+-column_name data_type .----------------.------+--------------><
      |                       +-column_options-+      |
      |                                               |
      +-CONSTRAINT constraint_name constraint_def-----+


data_type: 
       
 >-+-BOOLEAN---+---><
   +-SBYTE-----+  
   +-INT16-----+
   +-INT32-----+
   +-INT64-----+
   +-DATETIME--+
   +-DECIMAL---+
   +-SINGLE----+
   +-DOUBLE----+
   +-STRING(N)-+
   +-OBJECT----+
   

column_options:

 >-.----------.---.-----------------.---.----------.---.--------.---->
   +-NULL-----+   +-DEFAULT literal-+   +-READONLY-+   +-UNIQUE-+
   +-NOT NULL-+   +-DEFAULT ident---+
   
 >-.---------------------------.--.---------------.------------------><  
   +-AUTOINCREMENT FROM N BY N-+  +-CAPTION ident-+

constraint_def:


 >--+--PRIMARY KEY (column_list)--+--><
    +--UNIQUE (column_list)-------+

Parameters:

datatable_name The DataTable to be declared.
column_name The name of a column in the DataTable
data_type The column data types available.
column_options The column options available.
constraint_name The name of a constraint for the DataTable.
constraint_def The definition of the primary or unique key for the DataTable, as specified with columns.
column_list A list of columns in the DataTable, separated by commas.

Comments:

A DECLARE DATATABLE statement is required for each DataTable specified in a DECLARE DATASET statement.

The DECLARE DATATABLE statement syntax is similar to the embedded EXEC SQL CREATE TABLE statement.

Example:

     EXEC ADO
        DECLARE Orders DATATABLE
        ( OrderID               INT32           AUTOINCREMENT FROM -1 BY -1
         ,CustomerID            STRING(5)
         ,EmployeeID            INT32
         ,OrderDate             DATETIME
         ,RequiredDate          DATETIME
         ,ShippedDate           DATETIME
         ,ShipVia               INT32
         ,Freight               DECIMAL
         ,ShipName              STRING(40)
         ,ShipAddress           STRING(60)
         ,ShipCity              STRING(15)
         ,ShipRegion            STRING(15)
         ,ShipPostalCode        STRING(10)
         ,ShipCountry           STRING(15)
         , CONSTRAINT pk_Orders primary key(OrderID)) 
     END-EXEC.