Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 6966
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: 10211
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
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts Random Password (in string format) ge... ezhavendhan COBOL Programming 10 Mon Aug 29, 2016 3:18 pm
No new posts How to insert a lengthy string havin... vidyaa DB2 7 Thu Aug 25, 2016 5:20 pm
No new posts Which function does the Ampersand (&a... Andi1982 PL/I & Assembler 3 Wed Aug 24, 2016 2:05 pm
No new posts Need a help how to replace a string i... gurunath82 CLIST & REXX 12 Tue Jul 26, 2016 11:43 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us