做如下更新时,
UPDATE t
SET col= 'Stokke KEEP Complete-Cherry'
where ... -- 符合条件的只有一笔记录.
Msg 511, Level 16, State 1, Procedure xxx, Line 170
Cannot create a row of size 8062 which is greater than the allowable maximum row size of 8060.
查该t.col字段数据类型为varchar(500),且表中所有字段长度总和亦远小于8060,
后跟User联系确认该表曾有个xml字段,后来删除了.
估计是空间分配未回收问题(仅是估计),做表索引重建,问题解决.
DBCC DBREINDEX('t', '', 90)
if object_id('ta') is not null
drop table ta
go
create table ta(id int identity primary key, col1 char(8000), col2 char(40), col3 varchar(20))
go
insert into ta
values('col1', 'col2', '12')
go
select * from ta
go
update ta
set col3='1234567890'
go
select * from ta
go
alter table ta
drop column col1
go
select * from ta
go
update ta
set col3='1234567890'
go
dbcc dbreindex('ta', '', 90)
go
update ta
set col3='1234567890'
go
select * from ta
go
http://topic.youkuaiyun.com/u/20111107/09/4D3A2D90-33EB-49F2-9710-F119BD04EE62.html
解决SQL更新操作导致的行大小超出限制问题
本文详细阐述了一个SQL更新操作引发的错误,即无法创建超过最大允许行大小8060的8062字节行。通过分析数据库表结构和历史变更,发现可能是由于空间分配未被正确回收导致的问题。通过重建表索引和执行DBCC DBREINDEX命令,成功解决了这一问题。此外,文章还展示了通过创建临时表、插入数据、更新特定字段和删除无效字段来验证和修复数据库表的方法。
775

被折叠的 条评论
为什么被折叠?



