Symptoms

Consider the following scenario:

  • You have a table that has two or more bit data type columns in Microsoft SQL Server 2008 R2.

  • You create a clustered index that contains two or more bit data type columns on the table.

  • You create a nonclustered index on any column and specify the DATA_COMPRESSION option.

In this situation, you receive the following error:

Msg 1944, Level 16, State 1, Line <Line Number>Index '<Index Name>' was not created. This index has a key length of at least -<Length> bytes. The maximum permissible key length is <Length> bytes.

Cause

The issue occurs because the space requirements of bit data type columns are calculated incorrectly in this scenario.

Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:

Workaround

To work around this issue, change the data type of the columns from bit to tinyint.

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.