How to resolve the key length restriction index 900 in a column with varchar (4096) data type in SQL Server 2005?

This is a request to create an index to create an idx_ncl_2 index in BFPRODATTRASSOCIATION (value, attribute) include (productid)

BFPRODATTRASSOCIATION table structure

ProdAttrAssociationId bigint no 8
ProductId             bigint no 8
AttributeId           bigint  no  8
Value                 varchar no 4096

I get this error:

The maximum key length is 900 bytes. The idx_ncl_2 index has a maximum length of 1237 bytes.

I need to create a non-clustered index in this column. Is there a way to create an index for a column with a varchar data type and larger than 900.

Please offer.

+3
source share
2 answers

- , 900 .

varchar (4096). - SQL Server - , , . . Books Online - .

"" 900 , - . , "" ( ), , , - , 900 .

CREATE NONCLUSTERED INDEX idx_ncl_2 
  ON BFPRODATTRASSOCIATION(attributeid) 
  INCLUDE (productid, value)

.

+12

, . . - T-SQL - .

+4

Source: https://habr.com/ru/post/1748507/


All Articles