Cheryl L Hubert
Cheryl L Hubert

Reputation: 63

DB2: Sql to find specific text within column names

Need some help with SQL in DB2.

The schema SRC_TEST_PRD has hundreds of tables. I want the SQL to return :

  1. the tablename

  2. and the column name for all of those where the column name is LIKE 'DESC'.

Upvotes: 2

Views: 851

Answers (1)

GMB
GMB

Reputation: 222432

In DB2, you can query catalog view syscat.columns:

select tabname, colname
from syscat.columns
where tabschema = 'SRC_TEST_PRD' and colname like '%DESC%'

Upvotes: 1

Related Questions