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 2005 Forums
 Transact-SQL (2005)
 containstable help

Author  Topic 

iqmcl
Starting Member

8 Posts

Posted - 2009-12-14 : 11:25:41
Hi, I have a table that contains a varchar field, which I need to find similar records in another table. How can I use the something along these lines to find records where the value of the varchar field in table2 is like the value from table1 - I need to use the contains table and want to avoid table scans, any help is welcome! I may be taking the wrong approch!

SELECT j.Title,j.Description, cj.rank
FROM table2 J
inner join CONTAINSTABLE(table2, *, varcharfieldfrom table1) as cj
ON j.id = cj.[KEY]
WHERE cj.RANK > 110
ORDER BY cj.RANK DESC;

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-12-20 : 04:17:50
is your column full text indexed? if not, you might need to use LIKE or functions like patindex.
Go to Top of Page
   

- Advertisement -