Previous Topic: SQL Tables and LoggingNext Topic: Using Existing Tables


Creating SQL Tables

To create SQL tables, you can embed CREATE TABLE statements (one for each table) in an application, or you can submit CREATE TABLE statements through the CA Datacom Datadictionary Interactive SQL Service Facility. You can also create SQL tables through CA Dataquery (see the CA Dataquery documentation for details). To define an SQL table, you must specify the name of the table and the name, the data type and the length of each column in the table.

You can optionally specify if one or more columns are to have a unique value for each row of the table. You can specify this UNIQUE constraint on individual columns and/or a list of columns whose combined values are unique. Using the UNIQUE constraint creates a KEY entity-occurrence in CA Datacom Datadictionary.

Note: Uniqueness is enforced at the key level, not at the column level, that is to say, UNIQUE forces unique values for the entire key and not for the individual columns making up the key.

When you define your table, you can specify the area where the table data is to reside. If you do not specify the area name, the data is placed in a default area which is specified at installation for your convenience. If you want to store your data in an area other than the default, see your Database Administrator to have a specific area defined for your use.

When the CREATE TABLE statement is executed (either embedded or through the CA Datacom Datadictionary Interactive SQL Service Facility), the table, columns, and any KEY entity-occurrences generated by use of the UNIQUE option are defined to CA Datacom Datadictionary in PRODuction status and cataloged to the CA Datacom/DB Directory (CXX).