IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to search for a string which can be in any of the cols.


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Mon Aug 11, 2008 2:36 pm
Reply with quote

I have table which has nearly 250 columns. Nearly 150 columns are all VARCHAR. I want to search for a particular string with wildcard characters like '%sentine%' which can be in any one of the 150 columns.

Is there any way to search for a particular string in all the columns of a particular record based on their data type or something like that.
What i really want is, i want to search for a string or some characters in all the columns of a particular record and do the same for all the records.

OR

i have to use the old and tedious style
select * from tablename
where firstcol like '%senti%' or
secondcol like '%senti%' or
.
.
onehunderedandfiftycol like '%senti%'
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Aug 11, 2008 2:53 pm
Reply with quote

I'd dump the table and code something for the qsam.

searching 250 columns, means mentioning (typing the name of the column in sql) 250 columns.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Mon Aug 11, 2008 3:13 pm
Reply with quote

Is there any way of doing that...... What i asked.
QSAM = Queued Sequential Access Method that seem to be entirely not DB
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Aug 11, 2008 3:32 pm
Reply with quote

if You' d describe the process better somebody might come up with a solution

after the search what use are You going to make of the found rows?

unloading the table and using the dfsort find facility might be the fastest way to get what You ask for
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Mon Aug 11, 2008 3:47 pm
Reply with quote

Example
-------------

ID name address city designation
7 sushanth india andhra analyst
-----------------------------------------------------------

iam searching for a string '%an%'

The query should have searched in name,address,city & designation and result are found in name(sushanth) ,city(andhra), designation(analyst).

if one match found itself is enough.

The result of the query display the id itself is enough.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts file manager is doing string conversion IBM Tools 3
Search our Forums:

Back to Top