Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query

Status
Not open for further replies.

EOFR

Programmer
Jun 1, 2001
3
CA
Hi Gurus
I am a newbie to DB2 but with a thorough knowledge in SQL, I am just baffled by this.

Let's say that there is a column called NAME from table TAB1. I want to retrieve all records that have embedded spaces from this column (Something like 'Michael Jones' . Here is my query.

Select * from TAB1
where NAME like '% %';

I am getting all the records in the table instead of just a subset with the spaces in between. What am I doing wrong here?
 
Why don't you try the following query:

SELECT * FROM TAB1 WHERE POSSTR(NAME, ' ') <> 0

It should solve your problem.

Regards,
Suresh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top