如何在PRIMARY文件组上创建索引?

时间:2015-04-20 15:36:32

标签: sql sql-server indexing

CREATE NONCLUSTERED INDEX index
ON table (column1)
INCLUDE (column2, column3) ON ????;

表被分区为3个文件组 我想创建物理存储在PRIMARY文件组中的索引 我该怎么办?

1 个答案:

答案 0 :(得分:3)

您的语法是正确的 - 但是您只需要PRIMARY[]一起逃脱,即:

CREATE NONCLUSTERED INDEX IX1
ON table (column1)
INCLUDE (column2, column3) 
ON [PRIMARY];

如果您要移动现有索引,则需要drop the existing one

CREATE NONCLUSTERED INDEX IX1
ON table (column1)
INCLUDE (column2, column3) 
WITH (DROP_EXISTING = ON)
ON [PRIMARY];