将现有聚集列存储索引移动到不同的文件组

Move an existing Clustered columnstore index into a different file group

我正在尝试将现有的聚簇列存储索引从一个文件组移动到另一个文件组,但找不到执行该操作的任何命令。

编码我试过的代码:

ALTER TABLE CCSI ON [dbo].[t179_s1_LOSS_ByEvent_ORIGINAL_440F6776-6185-4416-89D8-B69334457B25] 
WITH ( MOVE TO FG_1 );

错误:

Msg 156, Level 15, State 1, Line 281 Incorrect syntax near the keyword 'ON'.

Msg 319, Level 15, State 1, Line 281 Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.

就像聚集索引一样,使用 DROP_EXISTING 在目标文件组上重新创建它。例如

create table foo(id int, a int)
create clustered columnstore index cci_foo on foo

go

create clustered columnstore index cci_foo 
on foo
with (drop_existing=on)
on fg2