Skip to content
Advertisement

Query to select all tables with specific last column Ibm Db2 z/os

Goal: I need to create a query to select all tables with specific last column Ibm Db2 z/os

So I know I need to change my where clause for this but pretty much I want to select all the tables in my schema that have the last column as BATCH_ID. I’ve tried a length based where clause but can’t figure it out also I know MySQL has an ordinal position feature but that’s not in IBM DB2 z/Os as far as I’ve seen. Any help would be appreciated.

Advertisement

Answer

SYSIBM.SYSTABLES
SYSIBM.SYSCOLUMNS

I don’t remember if C.COLNO starts from 0 or 1. Edit the query accordingly, if it starts from 0.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement