Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 search for Exactphrase , Any Word ,All words

Author  Topic 

krishna.netblogs
Starting Member

7 Posts

Posted - 2012-07-27 : 09:16:52

Hi

We have a application where customers search for data. In this page we provide search type is a drop down list box.There are four choices are

1.Exact Phrase

2.Any of the Word

3.All of the words

4.Boolean Search

the user type a string and select one of the search type from this list,Then accordingly we have to show the results.
We have to write a sql query to return results.We have wriiten sql using containstable().But it does not return all the results.

The below query we are using..

SELECT Distinct TOP 50 c.case_id,cal.cas_details
From g_case_action_log cal (READUNCOMMITTED)
Inner Join g_case c (READUNCOMMITTED) ON (cal.case_id = c.case_id)
INNER JOIN containstable(es.g_case_action_log, cas_details,
' "searchword" OR "<br>searchword" OR "searchword<br> " ') AS key_tbl
ON cal.log_id = key_tbl.[key]

For each search type,how the sql query should be written to get search results based on search criteria(Exact Phrase or Any Word or All Words or Boolean Search)
I need the actual sql logic to search for each type (Exact Phrase or Any Word or All Words or Boolean Search).

Can you Please help me

With Regards
krishna
   

- Advertisement -