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 2000 Forums
 SQL Server Development (2000)
 Full-Text query using CONTAINS( )

Author  Topic 

nmg196
Yak Posting Veteran

70 Posts

Posted - 2001-08-17 : 05:50:39
Hi,

I'm writing a query that searches a full-text indexed table (2 columns) using the CONTAINS keyword.

The user (web) can type in multiple words and the SQL is then built dynamically and used to query the database.

So they may type:
plastic box

and my search would be:
SELECT * FROM Categories WHERE CONTAINS(*, '"plastic*" AND "box*')


..which should match a row with "plastic boxes" in it's name field.

The trouble is, it also has an "aliases" field which is also indexed. The query can easily find a phrase that is entirely in the aliases field, or entirely in the name field, but if one word is in one field, and the other word is in the other field:

Name Alias
------------- -----------
Plastic Boxes enclosure

...then it won't find "plastic enclosure" because even using * in contains, doesn't seem to do what you'd expect.

How can I use CONTAINS to search across both fields as if they were one? Or at least, get that effect?

Thanks,

Nick...

edgtr
Starting Member

1 Post

Posted - 2006-04-20 : 10:26:49
SELECT *
FROM Tbl_data
WHERE CONTAINS(Title, 'baseball bat')

Any idea this will work? It multiple words search.



Go to Top of Page
   

- Advertisement -