views:

179

answers:

2

I have a database table with the primary column defined as:

ID bigint identity primary key

I also have a text column MiddlePart. I'm trying to create a full text index, like so:

CREATE FULLTEXT INDEX ON domaining.dbo.DomainName
(
    MiddlePart 
    Language 0X0
)
KEY INDEX ID ON domaincatalog
WITH CHANGE_TRACKING AUTO

I get this error:

'ID' is not a valid index to enforce a full-text search key. A full-text search key must be a unique, non-nullable, single-column index which is not offline, is not defined on a non-deterministic or imprecise nonpersisted computed column, does not have a filter, and has maximum size of 900 bytes. Choose another index for the full-text key.

What am I doing wrong?

+2  A: 

After KEY INDEX, you need to specify the name of the index not the column. To find the name of the index on the column ID, type sp_help DomainName and there will be a list of indexes on that table. The pk will be named something like PK_xxxxx. Use that index name instead of "ID".

DyingCactus
+1  A: 

Instead of specifying the column name, specify the name of the index. You can find the name of the primary key index like:

select name from sysindexes where object_id('DomainName') = id

Then you can create a fulltext index like:

CREATE FULLTEXT INDEX ON DomainName
(
    MiddlePart 
    Language 0X0
)
KEY INDEX PK__DomainName__40E497F3 ON domaincatalog
WITH CHANGE_TRACKING AUTO
Andomar