简体   繁体   中英

How to resolve the error "The index entry of length 904 bytes for the index 'IX_companyinfo_exhibition' exceeds the maximum length of 900 bytes."

i am getting the error as:

"The index entry of length 904 bytes for the index 'IX_companyinfo_exhibition' exceeds the maximum length of 900 bytes".

exblist nvarchar(600) ,i changed this to nvarchar(450) .i dropped the index ie. IX_companyinfo_exhibition .

i tried everything.even i used this:

CREATE NONCLUSTERED INDEX IX_companyinfo_exhibition ON dbo.companyinfo(exblist) include(companyname,website,country,contactperson,telphone)

i dont know whats wrong with this.still i am getting the same error.

在此处输入图片说明

在此处输入图片说明

表 companyinfo 的 SP_helpindex

Based on SQL Server documentation , nvarchar(450) should work.

I do find the "904" to be confusing. The actual size of nvarchar(450) is 902 bytes (see here ). No doubt, the extra two bytes are coming from somewhere.

So, you should be able to fix this by using nvarchar(448) .

If that is not possible, you can add another column and index that:

alter t add exblist448 as (left(exblist, 1, 448))

and then index this.

All that said, I don't think this will solve your real problem. I don't see why an index on a 450-character string would be needed. I also don't understand why a column name would contain "list".

I strongly suspect that you really need either a second table with one row per list item and company. Or, you need a full text index.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM