Strangenut

Changing a clustered primary key to non-clustered in SQL Server 2000/2005/2008

By default, when you create a primary key column in SQL Server, it makes it a clustered index.  Sometimes this will be a default advantage, sometimes a serious disadvantage for performance as clustered indexes are the cornerstone of performance tuning in SQL Server.  In the event that a clustered primary key gets created and you need to change it to a non-clustered one, follow these steps:

  1. Open the table in design view in SQL Server Management Studio (right click on the table in the object explorer, click 'Modify')
  2. Right Click anywhere over the column definitions, from the context menu click 'Indexes/Keys'
  3. Select your primary keys index by name in the right listbox
  4. In the right pane, under the section titled 'Table Designer' find the item labeled 'Create as Clustered' and change the 'Yes' to 'No'.
  5. Click close, then close the design view of the table, and choose the option to save.
  6. If you have full text catalogs on this table you may need to repopulate them.

That should be it, now you are able to create a clustered index on another column or set of columns on your table.


Posted Jan 18 2009, 09:25 PM by dacrowlah
Powered by Community Server (Non-Commercial Edition), by Telligent Systems