Search code examples
sql-serveraltersql-types

How to alter table when full text search is enabled?


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.


Solution

  • 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