DB2 for IBM i – Why Not All Columns Show Up on SELECT *

db2iseries

My client has a table on their IBMi with a foreign key to another table. It's not showing up with a SELECT * FROM lib.table. However, if I specifically mention it in the column list. It does show up.

SELECT
        col1, col2.col3, fxcolid
    FROM  lib.table

I'm using the jt400 driver to query from SQLWorkbench/J.

Best Answer

There is an IMPLICITLY HIDDEN column attribute that can be applied. Please check for this...

This means the column will only appear when it is explicitly specified on the SELECT statement.

Check the CREATE TABLE statement for this property, or materialize the TABLE's DDL using some API or tool, such as RTVSQLSRC.