列具有无法参与列存储索引的数据类型

Column has a data type that cannot participate in a columnstore index

我想使用以下查询在 table 中创建聚集列存储索引:

CREATE CLUSTERED COLUMNSTORE INDEX cci
ON agl_20180319_bck

我收到这个错误:

Msg 35343, Level 16, State 1, Line 6
The statement failed. Column 'memberOf' has a data type that cannot participate in a columnstore index. Omit column 'memberOf'.

'memberOf' 属于这种类型:memberOf nvarchar(max)

如何 overcome/ignore 这个错误,它是什么意思?

您需要单独指定参与列,不包括 memberOf 和任何其他不能在 columnStore 索引中使用的列

根据documentation

Columns that use any of the following data types cannot be included in a columnstore index:

nvarchar(max), varchar(max), and varbinary(max) (Applies to SQL Server 2016 and prior versions, and nonclustered columnstore indexes)

要么更改列的类型(如果可以),要么就是在该特定列上没有列存储索引。

只需指定 varchar 变量的长度而不是使用最大值。对我有用!