Full-text index does not create

I am trying to evade a Fulltext index on a table column, but it gives me an error.

My request is as follows:

create table products
(
p_id int primary key,
p_name varchar(50),
)

insert into products values(1,'Sugar')
insert into products values(2,'Tea')
insert into products values(3,'Flour')
insert into products values(5,'Soap')

create index pname on products(p_name)
select * from products

create fulltext catalog product as default

create fulltext index on products(p_name) key index pname on product

      

it gives this error:

Msg 7653, Level 16, State 2, Line 1 'pname' is not a valid index for enforcing a full-text search key. The full-text search key must be a unique, non-null, single-column index that is not self-contained, is not determinable on a non-deterministic or imprecise non-portable column, has no filter, and has a maximum size of 900 bytes. Choose a different index for the full-text key.

+3


source to share


1 answer


You must give a name to your primary key and use that as the KEY INDEX in the last statement.

create table products
(
p_id int CONSTRAINT [PK_products] PRIMARY KEY,
p_name varchar(50),
)

....
create fulltext index on products(p_name) key index PK_products on product

      



KEY INDEX index_name

Is the name of the unique key index for table_name. KEY INDEX must be a unique, single key, non-nullable column. Choose the smallest unique key index for the full-text unique key. For best performance, we recommend an integer data type for the full-text key.

+3


source







All Articles