I've started creating descriptive table names in DB2 and have found DB2 has a short name and a long name for each table.
EmployeePlan has a short name of Emplo00001
I would like to be able to display both names from a sql statement. Here's my existing SQL -- is there a table I can join to in order to get the short name?
select * --table_name, system_column_name, column_text, Type_Name, column_Size, *
from sysibm.SQLColumns
where table_schem IN ('LAWMOD9T', 'LIBDDS')
and upper(table_name) IN ('EMPLOYEEPLAN')
ORDER BY system_column_name
And thank you, Darius X for answering my question so quickly. Here's my final query:
SELECT b.system_table_name as ShortName,
a.table_name, a.system_column_name, a.column_text,
a.type_name, a.column_size
FROM sysibm.SQLColumns a
INNER JOIN qsys2.systables b
ON a.table_name = b.table_name
AND a.table_schem = b.table_schema
WHERE UPPER(a.table_schem) IN ('LAWMOD9T', 'LIBDDS')
AND UPPER(a.table_name) IN ('EMPLOYEEPLAN')
ORDER BY a.table_schem, a.table_Name, a.ordinal_position