Solved

Search Entire Database for String

Posted on 2007-12-04
1
3,247 Views
1 Endorsement
Last Modified: 2008-02-01
How do I go about searching an entire DB2 database for any instance of a string criteria?

i.e. Any field in any table with the string "%Testing%"
1
Comment
Question by:DJmistral
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 45

Accepted Solution

by:
Kent Olsen earned 125 total points
ID: 20404910
Hi DJmistral,

You'll have to query each table.

One way to do that is to write SQL to generate SQL.  A relatively common thing for DBAs to do.

SELECT 'SELECT * FROM ' || rtrim(table_schema) || '.' || table_name || ' WHERE ' || Column_name || ' like ''%Testing%'';'
FROM sysibm.columns
WHERE table_schema = ''
  AND table_name = ''
  AND DATA_TYPE = 'CHARACTER VARYING';

Replace the '' with the appropriate schema and table names and that QUERY will generate SELECT statements for you.  Copy and past them into the client window and execute them.


Good Luck,
Kent
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Procedure to create a text file in DB2 on AS400 15 576
Check file/object size on AS400 3 207
how to apply the SSL on iseries and WAS application 1 141
db2 != check 14 59
November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question