How to query table column names in DB2?

You can query table column names in DB2 using the following methods.

  1. Use the DESCRIBE command:
DESCRIBE TABLE <表名>;
  1. Utilize system views:
SELECT COLUMN_NAME
FROM SYSIBM.SQLCOLUMNS
WHERE TABLE_NAME = '<表名>'
ORDER BY ORDINAL_POSITION;
  1. Utilize system tables:
SELECT NAME
FROM SYSIBM.SYSCOLUMNS
WHERE TBNAME = '<表名>';

Please replace

with the actual name of the table you want to query.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds