Saturday, February 25, 2012

ContainsTable not returning rows

Hello folks,
I have a table with several FT-enabled varchar columns, in SQL Server
2000.
If I ask for SELECT * FROM tbl WHERE CONTAINS(*, SearchStringA) I get
several rows. (as expected)
If I ask SELECT * FROM tbl WHERE CONTAINS(*, SearchStringB) I also get
several rows and they are an overlapping set of rows. (also as expected)
However, if I ask for SELECT * FROM tbl WHERE CONTAINS(*, SearchStringA AND
SearchStringB) I get no rows. The two seperate searches find matches in
different columns. Is this the problem, and if so, what is the best way to
get a correct result?
Thanks in advance,
Martin
If you want to look across columns you would have to do a FreeText query,
however with contains you would have to do this
select * from tablename where contains(col1, 'SearchPhraseA') or
contains(col2,'SearchPhraseB')
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Martin Hungerford" <Martin Hungerford@.discussions.microsoft.com> wrote in
message news:4E584970-A671-460B-A6AE-B65ECC68DBF9@.microsoft.com...
> Hello folks,
> I have a table with several FT-enabled varchar columns, in SQL Server
> 2000.
> If I ask for SELECT * FROM tbl WHERE CONTAINS(*, SearchStringA) I get
> several rows. (as expected)
> If I ask SELECT * FROM tbl WHERE CONTAINS(*, SearchStringB) I also get
> several rows and they are an overlapping set of rows. (also as expected)
> However, if I ask for SELECT * FROM tbl WHERE CONTAINS(*, SearchStringA
AND
> SearchStringB) I get no rows. The two seperate searches find matches in
> different columns. Is this the problem, and if so, what is the best way to
> get a correct result?
> Thanks in advance,
> Martin

No comments:

Post a Comment