If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Search Query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-31-04, 20:03
Shinto Shinto is offline
Registered User
 
Join Date: Jan 2004
Posts: 25
Search Query

I have the following table called Test with the following columns.

Items
---------
pest
best
test
destruct


Is there anyway of selecting everything in the table if i do a search for est? Meaning, i wanna select any items containing 'est'. Is there a possible SQL statement for it? Thanks.
Reply With Quote
  #2 (permalink)  
Old 03-31-04, 20:52
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
use the LIKE statement:

where column-name like '%est%'

See the SQL Reference for more details on LIKE and the use of % and _.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 04-02-04, 01:07
hurmavi hurmavi is offline
Registered User
 
Join Date: Jan 2004
Location: Europe, Finland, Helsinki
Posts: 60
Quote:
Originally posted by Marcus_A
use the LIKE statement:

where column-name like '%est%'

See the SQL Reference for more details on LIKE and the use of % and _.
Hi

One word of caution. Doing a search like that into big table will cause an index space scan & a major performance 'hog'. We have one like this in our company (OS/390 environment), and it's a real PROBLEM.

Cheers, Bill
Reply With Quote
  #4 (permalink)  
Old 04-02-04, 01:09
Shinto Shinto is offline
Registered User
 
Join Date: Jan 2004
Posts: 25
Thanks for the caution.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On