Monday, March 12, 2012

MS SQL full-text index search

First of all I'm new to MS SQL, I did work with mySQL

Table name db (real db has 12 columns)

Id c1 c2 c3

1 tom john olga

2 tom john olga bleee

I enabled full text index on all columns

Problem when I do search like this:

SELECT * FROM db WHERE CONTAINS(*,'"tom" AND "john"')

It will return only one row (id 2) – I understand that the full text search does look only at one column at a time because it did not return row #1

Anyway I thought that I can add extra column c4 and when user enters new data it will save data from columns c1, c2, c3 to c4 (varchar(750)) and then I will do search only on c4 – this way it will work the way I want.

1) Is there any better way to do this?

2) How do I sort results by "rank" with SQL

Anyone please - Is there any better way to do this?

No comments:

Post a Comment