views:

182

answers:

1

I have a table (table 1) with couple of column on which i want indexed.
There is also ArticleID column (foreign key), with this id I want to use join to retrieve "articleTitle" from the article Table (table 2), and of curse be able to search in this column.

How do I create this kind of index?
Do I need to index both tables?
and how should i write the select query for that?

A: 

You need to create a view and index that

I spent a lot of time on this a while back and the view was the only way I was able to do this.

I also ended up putting everything in 1 column. By this I mean that I added all the text from each column into one column. For example you have a simple table with ID, first, middle, last name columns. In my view I would condense them to 1 column in my view. So for a row of

ID:1 - First Name: Joe - Middle Name: Bob - Last Name: Joe

In the view you would see one column with

1 Joe Bob Joe

This was because I found that some records were not being returned if they were not in ALL columns. Thus by condensing it down to 1 column this problem was eliminated.

corymathews
what do you mean "putting everything in 1 column"?
markiz
Edited with more explanation.
corymathews
wow, it seems to be not a very nice solution and not efficient for the problem...Anyway how do i create index on view(is it possible to do it with full text wizard in management studio)?
markiz
Off hand I do not remember it was a long time ago. Hopefully someone will come in and answer that for you.
corymathews