#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2010
    Posts
    1
    Rep Power
    0

    DB2 LIKE operator


    Hello,

    I am new to this forums and new to DB2 too.

    I need some help regarding the LIKE operator in DB2.

    Here is my requirement.
    I have a table that has values like:
    1234
    12345
    12345AB
    1234AB
    AB1234CD
    1234ABCD

    I am supposed to write a query that looks for '1234' and return these values:
    1234
    1234AB
    AB1234CD
    1234ABCD

    Any help is greatly appreciated.

    Thanks,
    Nikhil
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2010
    Location
    Katy, Texas
    Posts
    495
    Rep Power
    199
    Code:
    SELECT COL1 FROM MYTABLE WHERE 
    COL1 LIKE '%1234%' AND 
    COL1 NOT LIKE '%5%'
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    1
    Rep Power
    0

    Need Help to execute DB2 query containing LIKE operator in shell script


    Hi,

    How the DB2 query can be included in shell script with LIKE ??

IMN logo majestic logo threadwatch logo seochat tools logo