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
 

 

SQL: no data found with like %

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

New User


Joined: 26 Nov 2008
Posts: 5
Location: Bangalore

PostPosted: Mon Jan 12, 2009 2:09 pm    Post subject: SQL: no data found with like %
Reply with quote

I am running the following SQL query

SELECT DISTINCT ABC FROM
S#MNO.Table1
WHERE
ABC LIKE '%XYZ'

And no data is extracted.
But when i am running

SELECT DISTINCT ABC FROM
S#MNO.Table1

and serach XYZ in it, i find many entries.
I dont know what the problem is, the query is correct only. icon_sad.gif
Back to top
View user's profile Send private message

ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Mon Jan 12, 2009 2:57 pm    Post subject:
Reply with quote

Your first query is for findind all ABC which ends with XYZ .... if you have entries in table please use RTRIM(ABC) like '%XYZ' because spaces might be there after XYZ .... if not check whether your entries in your second query actually ends with XYZ ...
Back to top
View user's profile Send private message
Amsar

New User


Joined: 26 Sep 2008
Posts: 84
Location: Chennai

PostPosted: Mon Jan 12, 2009 3:00 pm    Post subject:
Reply with quote

Nidhi,

In query

Quote:
SELECT DISTINCT ABC FROM
S#MNO.Table1
WHERE
ABC LIKE '%XYZ'


Make sure that string 'XYZ' in the table is in uppercase format ,
If its is in lowercase format in table your query will not fetch any values.

Regards,
Amsar
Back to top
View user's profile Send private message
vishalbshah

New User


Joined: 01 Dec 2006
Posts: 61
Location: Pune

PostPosted: Fri Jun 15, 2012 9:53 pm    Post subject:
Reply with quote

Hi Ashimer,

By chance do you know whether using RTRIM would stop DB2 from using the column as index if that is available for that colum?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Jun 15, 2012 10:07 pm    Post subject:
Reply with quote

vishalbshah,

why would you ask someone,
that last posted to this thread 3 years ago,
(who incidentally has not posted a message in over a year)
who provided the incorrect answer to the question in this thread

a question,
that is being answered by GuyC in your other thread.

Personnally, if I had to ask someone other than GuyC a db2 question,
I would only ask someone like Craig Mullins
(who probably would not respond anyway to such a basic question as yours).
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 Sorting group data rajella DFSORT/ICETOOL 4 Sun Jan 22, 2017 11:32 pm
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 1 Mon Jan 02, 2017 11:16 am
No new posts JES2 JEC: Use UNIX Pipes to Pass Data... Virendra Shambharkar JCL & VSAM 21 Tue Dec 20, 2016 6:55 pm


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