在 Microsoft® SQL Server™ 中,表中行的最大允許大小為 8060 字節(jié)。一個行不能跨數(shù)據(jù)頁進行拆分。一個數(shù)據(jù)頁大小為 8 KB,由數(shù)據(jù)行和一些內(nèi)部數(shù)據(jù)結(jié)構(gòu)組成。
所以下面的SQL 語句創(chuàng)建表會報警告信息:
CREATE TABLE [dbo].[TestTable] (
[ID] [int] IDENTITY (1, 1) NOT NULL ,
[content1] [nvarchar] (4000) NULL ,
[content2] [nvarchar] (4000) NULL
)
Warning: The table 'TestTable' has been created but its maximum row size (16029) exceeds the maximum number of bytes per row (8060). INSERT or UPDATE of a row in this table will fail if the resulting row length exceeds 8060 bytes.
但是表仍然被創(chuàng)建了。但是在你做 Insert Update 操作的時候,就會報錯誤信息。
解決方法:
重新設(shè)計表結(jié)構(gòu)。把它分成兩個表,或者用Text字段。
Text 字段由于它的存儲方式。他在數(shù)據(jù)行只占16個字節(jié)的指針。