Differences

This shows you the differences between two versions of the page.

Link to this comparison view

using_reference_file_to_create_sql_table [2018/01/11 16:55]
using_reference_file_to_create_sql_table [2021/04/05 11:23] (current)
Line 1: Line 1:
 +====== Using Reference File to create SQL Table ======
  
 +<sxh sql>
 +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'
 +); 
 +</sxh>
 +
 +<note>"LABEL ON ... IS ... " sets the column heading of a field, whereas "LABEL ON ... TEXT IS ..." sets the text of a field.</note>
 +
 +{{tag>devel sql ibm}}