Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't delete primary key on table with FULLTEXT index

I have a table with a primary key that is an int data type. I want to drop this column (as it is unused, and I fear this column may reach the maximum limit of the int data type, so we may as well drop it.).

First, I could not drop I tried to first drop the constraint with:

ALTER TABLE dbo.MyTable DROP CONSTRAINT PK_MyTableID

I'm getting the error:

Cannot drop index 'PK_MyTableID' because it enforces the full-text key for table or indexed view 'MyTable'.

I don't understand this error, because the primary key is an int, and I don't think this table has a FULLTEXT index, but if it does, I don't need it.

EDIT:

I was able to drop the column after deleting the FULLTEXT index:

DROP FULLTEXT INDEX ON dbo.MyTable
like image 439
Jay Sullivan Avatar asked Aug 28 '14 20:08

Jay Sullivan


1 Answers

I believe there is a full text index on the table. A full text index requires you to have unique key:

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

You can check for a tables full text indexes using:

SELECT object_id, property_list_id, stoplist_id FROM sys.fulltext_indexes
    where object_id = object_id('myTable'); 
like image 104
JoshBerke Avatar answered Sep 30 '22 04:09

JoshBerke