News

Copyright © 2008-2019 Paula DiTallo

Tag Cloud



DB2: How do I get the Column Definitions, Column Descriptions?

These general statements will get you the information that you're looking for:


SELECT
TABLE_CAT,
TABLE_SCHEM,
TABLE_NAME,
COLUMN_NAME,
DATA_TYPE,
TYPE_NAME,
COLUMN_SIZE,
COLUMN_TEXT

FROM "SYSIBM"."SQLCOLUMNS"
WHERE TABLE_SCHEM = 'YourSchema'
 AND TABLE_NAME = 'YourTableName'

This will get you the definitions of the columns:

SELECT
t.table_schema as Library
,t.table_name
,t.table_type
,c.column_name
,c.ordinal_position
,c.data_type
,c.character_maximum_length as Length
,c.numeric_precision as Precision
,c.numeric_scale as Scale
,c.column_default
,t.is_insertable_into
FROM sysibm.tables t
JOIN sysibm.columns c
   on t.table_schema = c.table_schema
  and t.table_name = c.table_name
WHERE t.table_schema = 'YourSchema'
and t.table_name = 'YourTableName'
order by t.table_name, c.ordinal_position
Wednesday, April 22, 2015 4:15 PM

Feedback

No comments posted yet.


Post A Comment
Title:
Name:
Email:
Comment:
Verification: