Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to search for a string which can be in any of the cols.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Mon Aug 11, 2008 2:36 pm    Post subject: How to search for a string which can be in any of the cols.
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: 6968
Location: porcelain throne

PostPosted: Mon Aug 11, 2008 2:53 pm    Post subject:
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: 1013
Location: India

PostPosted: Mon Aug 11, 2008 3:13 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10326
Location: italy

PostPosted: Mon Aug 11, 2008 3:32 pm    Post subject: Reply to: How to search for a string which can be in any of
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: 1013
Location: India

PostPosted: Mon Aug 11, 2008 3:47 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
No new posts HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts How to change a string containing the... chong.zhou TSO/ISPF 6 Tue Aug 29, 2017 4:54 pm
No new posts String after '.' (period) is not copy... balaji81_k SYNCSORT 6 Wed Aug 23, 2017 9:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us