Month: May 2019

DB2 Regexp_Substr

Regexp_Substr is a scalar function which returns one occurrence of a substring that matches the regular expression pattern. Syntax : Regexp_Substr(source_string, pattern_expression, start, occurence, flags, group)   Example : Return the string which matches any character preceding a ‘a’. select regexp_substr(‘Today is mother’s day’, ‘.a’,1,1) from sysibm.sysdummy1 Result : ‘da’

Db2 – Get the largest files on the system

Using the Syspartitionstat view, we can get the largest files on the system.   Sql to get the first 100 largest files on the system. Select table_schema, table_name, table_partition, number_rows, number_deleted_rows, data_size, variable_length_size, ‘ number_distinct_indexes From qsys2.syspartitionstat Order By data_size desc Fetch 100 rows only.