Skip to content

Instantly share code, notes, and snippets.

@cernoel
Created June 28, 2017 08:03
Show Gist options
  • Save cernoel/ee6b4cc32c2ac464867cc9e6a719b5b2 to your computer and use it in GitHub Desktop.
Save cernoel/ee6b4cc32c2ac464867cc9e6a719b5b2 to your computer and use it in GitHub Desktop.
QlikView Load Script to get some DB2 Metadata
SET ThousandSep='.';
SET DecimalSep=',';
SET MoneyThousandSep='.';
SET MoneyDecimalSep=',';
SET MoneyFormat='#.##0,00 €;-#.##0,00 €';
SET TimeFormat='hh:mm:ss';
SET DateFormat='DD.MM.YYYY';
SET TimestampFormat='DD.MM.YYYY hh:mm:ss[.fff]';
SET MonthNames='Jan;Feb;Mrz;Apr;Mai;Jun;Jul;Aug;Sep;Okt;Nov;Dez';
SET DayNames='Mo;Di;Mi;Do;Fr;Sa;So';
SET errormode = 0;
// Requires
// --------------------
// Qlikview for Windows
// ODBC Connector Configured with Name DB2ODBCCONNECTION
ODBC CONNECT TO DB2ODBCCONNECTION (XUserId is ENCRYPTEDUSER, XPassword is ENCRYPTEDPASS);
//
// ###################################################################
// # ------------------ Qualifiers --------------------------------- #
// ###################################################################
Qualify *;
UnQualify "KEY_*", "§_*", "DEBUG_*";
STAR is *;
// ####################################################################
// #------------------------------------------------------------------#
// ####################################################################
DB2_Tables:
LOAD *
, TABLE_NAME as KEY_TABLENAME
, TABLE_SCHEM as KEY_TABLESCHEM
, TABLE_SCHEM + '.' + TABLE_NAME as KEY_FULL_TABLE_NAME
;
SQL
SELECT
TABLE_TYPE
, TABLE_NAME
, TABLE_SCHEM
, TABLE_TEXT
FROM
SYSIBM.SQLTABLES
;
DB2_Schemes:
LOAD *
, TABLE_SCHEM as KEY_TABLESCHEM
;
SQL
SELECT
TABLE_SCHEM
, SCHEMA_TEXT
FROM
SYSIBM.SQLSCHEMAS
;
DB2_Columns:
LOAD *
, TABLE_NAME as KEY_TABLENAME
;
SQL
SELECT
COLUMN_NAME
, COLUMN_TEXT
, COLUMN_SIZE
, SYSTEM_COLUMN_NAME
, TABLE_NAME
FROM
SYSIBM.SQLCOLUMNS
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment