Development

SQL Server – Columnstore Index creation error: A columnstore index cannot have INCLUDED columns

Hi friends, in my previous blog we learnt that sparse column cannot be part of columnstore index. In this blog we will discuss another limitation of columnstore index which is INCLUDE clause is not allowed while creating columnstore index.

Now, let’s create a test table and then we will try to create a nonclustered columnstore index using INCLUDE clause:

CREATE TABLE Test_Include

(

                ID INT,

                FirstName VARCHAR(10) NOT NULL,

                MiddleName VARCHAR(10),

                LastName VARCHAR(10) NOT NULL

)

Now let’s create a nonclustered columnstore index on this table using below script:

CREATE NONCLUSTERED COLUMNSTORE INDEX ix_TestInclude

ON Test_Include (ID, FirstName, LastName)

INCLUDE (MiddleName)

When we execute the above script it gives us error:

CREATE INDEX statement failed because a columnstore index cannot have included column. Create the columnstore index on the desired columns without specifying any included columns.’

 CS_2

Also, from the error message itself we come to know that included columns are not allowed in columnstore index.

Drop the table –

DROP TABLE Test_Include

So friends, this is another one of the limitation of nonclustered columnstore index. Hope you like it 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s