Is it possible to build a SQL query in which the name of a column would be dynamic?
I need to create statistics about the content of tables.
Hereafter is an extract of the request. For each column of MYTABLE, I want to know how many rows have a NULL value.
select co.TABNAME, co.COLNAME, (select count(*) from SQLDBA.MYTABLE where co.COLNAME is NULL)
from SYSCAT.COLUMNS co
where co.TABNAME = 'MYTABLE'
order by co.COLNO