Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 To: DEREK DODOO
  Where is DEREK DODOO?
 READING, UK
 United Kingdom
 DEREK DODOO
Subject: RE: SELECT WITH LIKE() FUNCTION
Thread ID: 182992 Message ID: 183010 # Views: 1 # Ratings: 0
Version: Visual FoxPro 6 Category: Databases, Tables and SQL Server
Date: Friday, July 11, 2008 9:52:46 AM         
   



> >
> > You can use Like() in a SQL statement, but it's an "xBase" function.
> > SQL has a native Like operator, which might be preferable I think
> > What do you want to do exactly?
> >
> >
CREATE CURSOR temp (test Char(20))
> > INSERT INTO temp VALUES ("Smith")
> > INSERT INTO temp VALUES ("Smythe")
> > SELECT * FROM temp WHERE LIKE('*it*',test)
> > SELECT * FROM temp WHERE test LIKE '%it%'
> > 

> >
> >
> > hth
> > -Stefan
>
>
> SELECT IDNO,FNAME,LNAME FROM INVOICE WHERE IDNO<>' ' AND
<B>LIKE(XNAME,FNAME)</B>
INTO CURSOR REP_CURSOR
>
> where 'XNAME' is a selected FNAME

Yes, that would be a good occasion to use the native SQL Like operator, i.e. to do it as in the 5th line in the example above.
IOW, if "xname" is a variable, then fill it with your desired string, add a '%' on the right side (and another one on the left if you want).

CREATE CURSOR invoice (fname Char(20))
INSERT INTO invoice VALUES ("Smith")
INSERT INTO invoice VALUES ("Smythe")
LOCAL xname
xname = '%ith%'
SELECT * FROM invoice WHERE fname Like ?m.xname



hth
-Stefan

ENTIRE THREAD

SELECT WITH LIKE() FUNCTION Posted by DEREK DODOO @ 7/11/2008 9:09:14 AM
RE: SELECT WITH LIKE() FUNCTION Posted by Jun Tangunan @ 7/11/2008 9:12:41 AM
RE: SELECT WITH LIKE() FUNCTION Posted by DEREK DODOO @ 7/11/2008 9:17:36 AM
RE: SELECT WITH LIKE() FUNCTION Posted by Mike Yearwood @ 7/11/2008 4:09:36 PM
RE: SELECT WITH LIKE() FUNCTION Posted by Anders Altberg @ 7/11/2008 2:51:39 PM
RE: SELECT WITH LIKE() FUNCTION Posted by Stefan Wuebbe @ 7/11/2008 9:19:24 AM
RE: SELECT WITH LIKE() FUNCTION Posted by DEREK DODOO @ 7/11/2008 9:36:31 AM
RE: SELECT WITH LIKE() FUNCTION Posted by Stefan Wuebbe @ 7/11/2008 9:52:46 AM
RE: SELECT WITH LIKE() FUNCTION Posted by DEREK DODOO @ 7/11/2008 11:47:00 AM
RE: SELECT WITH LIKE() FUNCTION Posted by Stefan Wuebbe @ 7/11/2008 11:52:40 AM
RE: SELECT WITH LIKE() FUNCTION Posted by surinder singh @ 7/11/2008 10:11:31 AM
RE: SELECT WITH LIKE() FUNCTION Posted by Cetin Basoz @ 7/11/2008 12:05:39 PM
RE: SELECT WITH LIKE() FUNCTION Posted by subhankar pandey @ 7/11/2008 1:28:10 PM
RE: SELECT WITH LIKE() FUNCTION Posted by Anders Altberg @ 7/11/2008 2:42:42 PM