Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Urgently needed! SQL Syntax in retrieving records...
Message
From
07/02/2002 04:08:52
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00616376
Message ID:
00616461
Views:
24
Ed,

>Actually, there's a completely trivial solution; simply parse the string cDesc and generate a unique WHERE clause at runtime. Using a regular expression parser such as VBScript.RegExp, you could create a regular expression which, when applied, would return a collection of tokens which could then be used to construct LIKE expressions immediately prior to invoking the SELECT statement; it might be worthwhile implementing it as an SP on each platform and taking advantage of platform-specific behaviors implementing the SELECT on each discrete platform.<

That's exaclty what I meant when I said 'build the WHERE clause'. It doesn't really matter how you parse cDesc.

A more important point is what you mentioned in your second paragraph - design. I don't know if this is an option for Jess, but I would certainly go the way you describe if I had to provide this kind of functionality.

>>Jess,
>>I cannot think of an easy solution. The only thing that comes to mind is to convert cDesc into an array and then build the WHERE clause using the syntax Sergey has suggested for each word. In any case, the query won't be optimized with these kind of operators.
>>Since you mentioned SQL Server, you may consider Full-Text Search, although I have no personal experience with this feature. If you were looking for a pure VFP solution, then phdBase would be an alternative.
>
>Actually, there's a completely trivial solution; simply parse the string cDesc and generate a unique WHERE clause at runtime. Using a regular expression parser such as VBScript.RegExp, you could create a regular expression which, when applied, would return a collection of tokens which could then be used to construct LIKE expressions immediately prior to invoking the SELECT statement; it might be worthwhile implementing it as an SP on each platform and taking advantage of platform-specific behaviors implementing the SELECT on each discrete platform.
>
>Honestly, it's a broadly boring problem; the table could easily be restructured to parse the description field into a supernormal set of attributes describing the record, and the query is then posed against the attribute set for each record. At that point, the query becomes optimizable...
Daniel
Previous
Reply
Map
View

Click here to load this message in the networking platform