安裝與升級 > 安裝與組態指南 > 資料庫安裝 > 安裝 SQL Server > 索引位元組限制
  
索引位元組限制
SQL Server 中索引金鑰的最大長度為 900 個位元組。如果索引超過 900 個位元組限制,則會擲出例外。若要防止擲出例外,請確保索引使用的資料值少於 900 個位元組。
以下是當索引大小超過 900 個位元組時擲出例外的範例:
例如:
當執行 insert 陳述式時,索引大小超過 900 個位元組
wt.pom.DatastoreException: A SQL error has occurred for the statement
"INSERT INTO WTUser(classnameA2A2,updateCountA2,blob$entrySetadHocAcl,
disabled,
classnamekeydomainRef,idA3domainRef,entrySetadHocAcl,eventSet,inherited
Domain,name,repairNeeded,markForDeleteA2,updateStampA2,createStampA2,modify
StampA2,idA2A2) VALUES (’wt.org.WTUSER’,1,?,?,?,?,?,?,?,?,?,?,?,?,?)".
Database system message follows: Nested exception is: java.sql.SQLException:
[ptc][SQLServer JDBC Driver][SQLServer]Operation failed. The index entry of
length 2000 bytes for the index ’WTUser$COMPOSITE’ exceeds the maximum
length of 900 bytes.
例如:
當執行 update 陳述式時,索引大小超過 900 個位元組
wt.pom.DatastoreException: A SQL error has occurred for the statement
"UPDATE WTUser SET blob$entrySetadHocAcl=?,disabled=?,classnamekey
domainRef=?,idA3domainRef=?,entrySetadHocAcl=?,eventSet=?,inherited
Domain=?,name=?,repairNeeded=?,markForDeleteA2=?,
updateStampA2=?,modifyStampA2=?,updateCountA2=updateCountA2+1 WHERE
((idA2A2 = ?) AND (updateCountA2 = ? ))" Database system message follows:
Nested Exception is: java.sql.SQLException: [ptc][SQLServer JDBC Driver]
[SQLServer]Operation failed. The index entry length of 2000 bytes for the
index ’WTUser$COMPOSITE’ exceeds the maximum length of 900 bytes.
此外,當執行 create_ddl_wt.bat 檔案時,您還可能會遇到警告。可以忽略這些警告。
例如:
執行 create_ddl_wt.bat 檔案
Warning: message=[ptc][SQLServer JDBC Driver][SQLServer]Warning! The
maximum key length is 900 bytes. The index 'WTUser$COMPOSITE' has
maximum length of 4000 bytes. For some combination of large values,
the insert/update operation will fail. command=CREATE INDEX WTUser$
COMPOSITE ON WTUser(name)