How to alter table when full text search is enabled?
-
26-05-2021 - |
문제
I have address table in which city field have nvarchar datatype, but I want to change datatype nvarchar to varchar. For that I have write the script
ALTER TABLE Address ALTER COLUMN City varchar(50) null
but when I execute this I have got the error message:
Msg 7614, Level 16, State 1, Line 1 Cannot alter or drop column 'City' because it is enabled for Full-Text Search.
So how can I resolve this error? I don't know anything about full text search.
해결책
You probably have a full text index on the table and that is not allowing you to alter a column with that.
So you can try:
DROP FULLTEXT INDEX ON Address
And then try:
ALTER TABLE Address ALTER COLUMN City varchar(50) null
And then you have to see what the index contains and recreate it
다른 팁
It would be wiser to check the contents of the full text index first before dropping it.
Also you might be better off using the following code instead:
ALTER FULLTEXT INDEX ON tableName DROP (ColumnName)
This will remove the fulltext index on only that column.