User Tools

Site Tools


using_reference_file_to_create_sql_table

Using Reference File to create SQL Table

CREATE OR REPLACE TABLE SCHMIDTM.FILEA AS (
  SELECT
    CAST(NULL AS INTEGER) AS id,
    firm AS firma,
    sais AS saison,
    jj AS jahr,
    fm1 AS formid1,
    fm2 AS formid2,
    fm3 AS formid3,
    CAST(NULL AS CHAR(60)) AS bez
    FROM SCHMIDTM.FREFP1
)
DEFINITION ONLY
INCLUDING COLUMN DEFAULTS
RCDFMT FILEAR1;

ALTER TABLE SCHMIDTM.FILEA ADD PRIMARY KEY (id);

LABEL ON TABLE SCHMIDTM.FILEA IS 'Datei A';

LABEL ON COLUMN SCHMIDTM.FILEA (
  id TEXT IS 'Id',
  firma TEXT IS 'Firma',
  jahr TEXT IS 'Jahr',
  formid1 TEXT IS 'Form Sacko',
  formid2 TEXT IS 'Form Hose',
  formid3 TEXT IS 'Form Weste',
  bez TEXT IS 'Bezeichnung'
); 

“LABEL ON … IS … ” sets the column heading of a field, whereas “LABEL ON … TEXT IS …” sets the text of a field.

using_reference_file_to_create_sql_table.txt · Last modified: 2018/01/11 15:55 by mihael