Alter clustered index column

indexing, sql, sql-server, sql-server-2008-r2, sql-server-2012

Solution

You cannot alter a clustered index.

The only option is to drop it and re-create it with the new column.

In your case, you'll probably have to re-create the table with the new clustered index on `ID` and then copy the data over.

Problem

I have a clustered index on a table indexing on the `text` column. I want to switch that column with a different column like `ID`, how do I alter the index? I can't drop and recreate because this is running on Azure and the table needs to have clustered index all the time. The SQL command and the syntax for changing index columns in an index. alter index ?

Original source