How to query table column names in DB2?
You can query table column names in DB2 using the following methods.
- Use the DESCRIBE command:
DESCRIBE TABLE <表名>;
- Utilize system views:
SELECT COLUMN_NAME
FROM SYSIBM.SQLCOLUMNS
WHERE TABLE_NAME = '<表名>'
ORDER BY ORDINAL_POSITION;
- Utilize system tables:
SELECT NAME
FROM SYSIBM.SYSCOLUMNS
WHERE TBNAME = '<表名>';
Please replace