Skip to content

Instantly share code, notes, and snippets.

View BirgittaHauser's full-sized avatar

Birgitta Hauser BirgittaHauser

View GitHub Profile
@BirgittaHauser
BirgittaHauser / RetrievePFwithUniqueKey
Created October 31, 2019 09:23
Determine DDS described physical files containing Unique Keys
-- Determine DDS described physical files with unique Keys
Select a.*
From syspartitionIndexstat a
Where Table_Schema = 'YOURSCHEMA'
and Index_Type = 'PHYSICAL'
and UNIQUE = '0';
@BirgittaHauser
BirgittaHauser / CvtNum2Date.SQL
Created October 24, 2019 10:43
SQL Function to convert a numeric date into a real date
-- 1. CvtNumYYYYMMDD2Date User Defined Function
-- Convert a numeric date in the format YYYYMMDD into a real date
Create or Replace Function YourSchema.CvtNumYYYYMMDD2Date (
ParDateNum Dec(8, 0) )
Returns DATE
Language SQL
Specific YourSchema.CvtNumYYYYMMDD2Date
Not Deterministic
Reads SQL Data
Called on NULL Input
@BirgittaHauser
BirgittaHauser / ReadCsv.SQL
Created October 24, 2019 10:14
Read *.Csv file and split the content into rows and columns directly with SQL (on Db2 for i)
-- Read *.csv file located within the IFS directly with SQL
----------------------------------------------------------------------------------
-- Birgitta Hauser - 2019-10-25
-- 1. *.csv file located in the IFS: /home/Hauser/Employee1.csv
-- with the following content (including the column description)
-- "EMPLOYEENO","NAME","FIRSTNAME","ADDRESS","ZIPCODE","CITY","COUNTRY"
-- 10,"Meier und Sohn","","Industriestr. 3-13","80333","Muenchen","DE"
-- 20,"Bauer","Herrmann","Wald-und-Wiesen-Weg. 4","63128","Dietzenbach","DE"