Last Updated on 17 Novembre 2019 by Roberto De Pedrini
I suggerimenti di MarkOne – n. 2
Index
DspFFD con SQL
Interrogando il catalogo del DB2 o sfruttando le procedure di DB2 for i Service è possibile visualizzare la definizione di una tabella (ovvero l’equivalente di DSPFFD).
Metodo 1
select ORDINAL_POSITION as "Pos", COLUMN_NAME "Nome", SYSTEM_COLUMN_NAME "Nome sis.", DDS_TYPE as "Tipo (DDS)", DATA_TYPE as "Tipo", DATA_TYPE_LENGTH as "Lungh.", NUMERIC_SCALE as "Dec.", IS_NULLABLE as "Cons.nulli", COLUMN_HEADING as "Descrizione", COLUMN_TEXT as "Descrizione (TEXT)", CCSID from table(qsys2/qsqsyscol2(char('DB2SAMPLE', 10), char('EMPLOYEE', 10))) as DefFile;
Metodo 2
select ORDINAL_POSITION as "Ord.", SYSTEM_COLUMN_NAME as "Col.sist.", COLUMN_NAME as "Col.", DATA_type as "Tipo", sum(STORAGE) over(partition by 1 order by ORDINAL_POSITION) - STORAGE + 1 as "Pos.", LENGTH as "Lungh.", NUMERIC_SCALE as "Dec.", COLUMN_TEXT as "Descrizione (testo)", COLUMN_HEADING as "Descrizione" from QSYS2/SYSCOLUMNS where TABLE_SCHEMA = 'DB2SAMPLE' AND TABLE_NAME = 'EMPLOYEE' order by ORDINAL_POSITION;
Leggi questo articolo e molti altri sul sito https://www.markonetools.it