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)
 using NEAR in CONTAINS with parameters

Author  Topic 

svadakattu
Starting Member

2 Posts

Posted - 2007-07-02 : 15:47:30
Hi,

I am having a problem with the use of NEAR in CONTAINS Transact-SQL. Its working fine for queries which say 'apple near lemon' but is not giving the results for queries which have parameters for example '@keyword1 near @keyword2'.

Should I use a different syntax? Can somebody help me with this?

Sravan

MS CSE
UH

EDIT (from tkizer): moved topic out of Script Library forum

dbwilson4
Yak Posting Veteran

50 Posts

Posted - 2007-07-02 : 19:02:28
do it like this

"SELECT * FROM table WHERE LIKE @keyword1 + ' near ' + @keywword2";

Go to Top of Page

svadakattu
Starting Member

2 Posts

Posted - 2007-07-02 : 23:05:03
Hey Wilson,
Thanks for replying.
I tried it for the below query but didnt work. Do you mean we can get the same results by using Like instead of contains

SELECT seriesid,lastname,Series.comments
FROM Patient, Study, Series
WHERE to_patientid = patientid and to_studyid = studyid and
Contains((Series.comments), @keyword_1 + 'near' + @keyword_2 )


MS CSE
UH
Go to Top of Page
   

- Advertisement -