Sql-docs: "columnstore table does not allow a primary key constraint" is false?

Created on 9 Jan 2020  Â·  3Comments  Â·  Source: MicrosoftDocs/sql-docs

This documentation states "By design, a columnstore table does not allow a primary key constraint."

This doesn't appear to be true. See this example:

CREATE TABLE t_account (
AccountKey int NOT NULL PRIMARY KEY NONCLUSTERED,
AccountDescription nvarchar (50),
AccountType nvarchar(50),
UnitSold int
);

CREATE CLUSTERED COLUMNSTORE INDEX t_account_cci ON t_account ;

This executed fine in SQL 2017. I think what the documentation intends to say is that the table cannot have a clustered primary key, since the table is a clustered columnstore index.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri2 assigned-to-author doc-bug sqprod table-view-indetech

All 3 comments

@samrueby -- Sam, thank you for your feedback and your researches.

@MikeRayMSFT -- please look into this issue 3938.

@samrueby - thanks for the submission. Verifying.

Fixed by adding "clustered". Does not allow a clustered PK.

Was this page helpful?
0 / 5 - 0 ratings