Need some help with queries in DB2

342815 pts.
Tags:
DB2
DB2 query
Members on our team have a massive database that's housed in DB2 for i server that they are accessing through SQL Explorer. But the tables aren't very well documented and they're trying to do a few things with it.
  1. Search the entire database that look for tables with a column called "Remarks"
  2. Search the column for a keyword
  3. And a table returned which includes the names of the tables that includes the keywords.

Here's what I tried so far:

SELECT *
FROM <dbname>
WHERE Remarks LIKE '<keyword>'

Can anyone push us in the right direction?

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta

    You can query the system catalog to find the names of all tables that have a column named 'REMARKS':

    SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME FROM QSYS2.SYSCOLUMNS
    WHERE COLUMN_NAME = 'REMARKS'

    And for each table returned, you can query its REMARKS column for the keyword:

    SELECT * FROM TABLE_SCHEMA.TABLE_NAME WHERE REMARKS LIKE '%keyword%'

    There are details about both queries that might need attention. For example, a column might be named 'REMARKS' or 'Remarks'. In order to get a equal match, that query should be case-insensitive. The keyword search could be similar.

    But details need to be determined after the basics are working.

    Tom

    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following