我再sql2005定义一个表
create table test
(tid int identity(1,1),
ttextn nvarchar(max),
ttext1 varchar(max),
text1 nvarchar(4000),
text2 varchar(8000)
)
创建成功,并且成功插入数据
查询每个字段里内容的长度
select len(ttextn) as lentext,len(ttext) as lentextn,len(text1) as lentext1,len(text2) as lentext2 from test执行结果:
lentext  lentext  lentext1  lentext2
5212 10781 1039 7898
8344 NULL NULL NULL问题:为什么没提示页的长度超过8060kb

解决方案 »

  1.   

    因为你用了varchar,而非char类型. varchar是需要时分配空间,故实际数据没有超过8060时不报错.create table test
    (tid int identity(1,1),
    ttextn nvarchar(max),
    ttext1 varchar(max),
    text1 char(4000), -- 用char类型.
    text2 char(8000)  -- 用char类型.
    )-- 报错信息
    Msg 1701, Level 16, State 1, Line 4
    Creating or altering table 'test' failed because the minimum row size would be 12011, 
    including 7 bytes of internal overhead. This exceeds the maximum allowable table row size of 8060 bytes.