Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Urgently needed! SQL Syntax in retrieving records...
Message
From
07/02/2002 02:57:51
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00616376
Message ID:
00616447
Views:
24
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.

HTH
>Sergey,
>
>cDesc is variable which means the string don't have specific length and have no specific no. of words typed. It can have "Chol Vibrio cholera biovar" in any order.
>
>Something similar to Where cdesc $ description without truncating the words which are separated by spaces. And the SQL Syntax must be ANSI to make it SQL Server compatible. I know that there is a workaround but I need to confirm if there is a simplified alternative.
>
>>You should split the string into three parts and check for each of them. Something like
>>Where description Like "%" + LEFT(cDesc,4) + "%" OR/AND ;
>>  description Like "%" + RIGHT(cDesc,4) + "%" OR/AND ;
>>  description Like "%" + SUBSTR(cDesc,6,4)
>>
>>>Supposing I have a string variable cDesc = "VIBR CHOL BIOV" and will use this as reference to retrieve all records with descriptions containing any of the 3 words in any order. If description field contains "Cholera due to Vibrio cholerae 01, biovar cholerae" or "Cholera due to Vibrio cholerae 01, biovar eltor", these records should be included in the resultset.
>>>
>>>Where description = "%"+cDesc+"%" clause is not sufficient to do the above problem.
>>>
>>>Any inputs are highly appreciated!
>>>
>>>TIA
Daniel
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform