设非主键为聚集索引

如何设置非主键为聚集索引,只需下面三步:

1.去掉主键字段上面的主键约束,此时该字段不是主键了。

2.创建聚集索引到其它列 create clustered index test_index on tablename(column)

3.重新设置原来的主键字段为主键,此时会自动建立非聚集索引【因为已经有了聚集索引】 alter table tablename add primary key (id)

原文地址:https://www.cnblogs.com/chenh/p/6762446.html