最大行大小为8060错误

时间:2013-08-12 17:34:06

标签: sql-server sql-server-2008

我被困住了,我无法弄明白。有没有人有任何想法?我非常感谢任何帮助。

我在SQL Server 2008中有一个表,其定义如下:

我可以插入/删除/更新而不会出现任何错误。但是,当我运行一个过滤掉单个项目的select语句时,我收到以下错误:

  

Msg 511,Level 16,State 1,Line 1   无法创建大小为8104的行,该行大于允许的最大行大小8060。

如果我删除where条件a15.MEMBER_PARENT_LEVEL_ID4 in (91329)它运行正常。如果我添加5或10个标准它运行正常,包括如果你自己添加它就抛出错误的那个。

[MSTR_PROD_HIER_ID] [int] NOT NULL,
[MSTR_PROD_HIER_DESC] [varchar](50) NULL,
[MEMBER_GROUP_LEVEL_ID1] [int] NULL,
[MEMBER_GROUP_LEVEL_DESC1] [varchar](60) NULL,
[MEMBERKEY_SORT1] [int] NULL,
[MEMBER_GROUP_LEVEL_ID2] [int] NULL,
[MEMBER_GROUP_LEVEL_DESC2] [varchar](60) NULL,
[MEMBERKEY_SORT2] [int] NULL,
[MEMBER_GROUP_LEVEL_ID3] [int] NULL,
[MEMBER_GROUP_LEVEL_DESC3] [varchar](60) NULL,
[MEMBERKEY_SORT3] [int] NULL,
[MEMBER_LEVEL_ID4] [int] NULL,
[MEMBER_LEVEL_DESC4] [varchar](60) NULL,
[MEMBER_LEVEL_DESC4_1] [varchar](60) NULL,
[MEMBER_PARENT_LEVEL_ID1] [int] NOT NULL,
[MEMBER_PARENT_LEVEL_DESC1] [varchar](60) NULL,
[SORT1] [int] NULL,
[MEMBER_PARENT_LEVEL_ID2] [int] NULL,
[MEMBER_PARENT_LEVEL_DESC2] [varchar](60) NULL,
[SORT2] [int] NULL,
[MEMBER_PARENT_LEVEL_ID3] [int] NULL,
[MEMBER_PARENT_LEVEL_DESC3] [varchar](60) NULL,
[SORT3] [int] NULL,
[MEMBER_PARENT_LEVEL_ID4] [int] NULL,
[MEMBER_PARENT_LEVEL_DESC4] [varchar](60) NULL,
[SORT4] [int] NULL,
[CLASS_DESC] [varchar](60) NULL,
[CLASS_DESC1] [varchar](50) NULL,
[TOTAL_BRAND_IND] [int] NOT NULL
}


{
select    a11.PlanFormat  PlanFormat,
max(a18.FormatName)  FormatName,
a15.MEMBER_PARENT_LEVEL_ID2  MEMBER_PARENT_LEVEL_ID2,
max(a15.MEMBER_PARENT_LEVEL_DESC2)  MEMBER_PARENT_LEVEL_DESC2,
a15.MEMBER_PARENT_LEVEL_ID3  MEMBER_PARENT_LEVEL_ID3,
max(a15.MEMBER_PARENT_LEVEL_DESC3)  MEMBER_PARENT_LEVEL_DESC3,
a15.MEMBER_PARENT_LEVEL_ID4  MEMBER_PARENT_LEVEL_ID4,
max(a15.MEMBER_PARENT_LEVEL_DESC4)  MEMBER_PARENT_LEVEL_DESC4,
max(a15.CLASS_DESC)  CLASS_DESC,
max(a15.CLASS_DESC1)  CLASS_DESC1,
a16.MSTR_SEASON_ID  MSTR_SEASON_ID,
max(a16.MSTR_SEASON_DESC)  MSTR_SEASON_DESC,
max(a16.MSTR_SEASON_DESC1)  MSTR_SEASON_DESC1,
a17.MSTR_STORE_ID  MSTR_STORE_ID,
max(a17.MSTR_STORE_DESC1)  MSTR_STORE_DESC1,
a13.MSTR_C_MNTH_ID  MSTR_C_MNTH_ID,
max(a13.MSTR_C_MNTH_DESC)  MSTR_C_MNTH_DESC,
a13.MSTR_CALENDAR_GRP_ID  MSTR_CALENDAR_GRP_ID,
max(a13.MSTR_CALENDAR_GRP_DESC)  MSTR_CALENDAR_GRP_DESC,
a12.YEAR_NBR  YEAR_NBR,
a11.PlanNo  PlanNo,
max(a18.PlanName)  PlanName,
sum((a11.Value1821 / 1000.0))  ACT_PROJ_SLS_DOL
from    A_MSTR_PLAN_FCT    a11
join    A_MSTR_CALENDAR_MONTH_XREF    a12
on     (a11.Member2 = a12.Member2)
join    A_MSTR_CALENDAR_MONTH    a13
on     (a12.DIM_TIME_ID = a13.DIM_TIME_ID and 
a12.YEAR_NBR = a13.YEAR_NBR)
join    A_MSTR_PRODUCT_LEVEL_3    a14
on     (a11.MEMBER0 = a14.P_MEMBER3)
join    A_MSTR_PRODUCT_LEVEL_3_PARENT    a15
on     (a14.MEMBER_LEVEL_ID4 = a15.MEMBER_LEVEL_ID4 and 
a14.MSTR_PROD_HIER_ID = a15.MSTR_PROD_HIER_ID)
join    A_MSTR_SEASONALITY    a16
on     (a11.MEMBER3 = a16.MEMBER3)
join    A_MSTR_STORE    a17
on     (a11.MEMBER1 = a17.MEMBER1)
join    A_MSTR_PLAN    a18
on     (a11.PlanNo = a18.PlanNo and 
a12.YEAR_NBR = a18.YEAR_NBR and 
a13.YEAR_ID = a18.YEAR_ID)
where    (a11.PlanNo in (1547)
and a15.MEMBER_PARENT_LEVEL_ID4 in (91329))
group by    a11.PlanFormat,
a15.MEMBER_PARENT_LEVEL_ID2,
a15.MEMBER_PARENT_LEVEL_ID3,
a15.MEMBER_PARENT_LEVEL_ID4,
a16.MSTR_SEASON_ID,
a17.MSTR_STORE_ID,
a13.MSTR_C_MNTH_ID,
a13.MSTR_CALENDAR_GRP_ID,
a12.YEAR_NBR,
a11.PlanNo
}

这是一个跟进。到我以前的帖子。正如我在下面提到的,在我删除表,执行DBCC清理并重新创建表之后,此错误消失了。现在,它回来了,但这一次,只有当你选择两个或更多标准时。问题似乎与过滤我的产品的where条件有关。我的产品表没有任何nvarchar或varbinary。 我很沮丧......: - (

2 个答案:

答案 0 :(得分:0)

我建议修改查询以删除IN子句,并将其替换为其他连接或WHERE EXISTS。这可以生成更有效的查询计划,避免您遇到的问题。

答案 1 :(得分:0)

如果您的物理数据大小小于8060,那么您也会收到此错误,请尝试执行以下命令。

DBCC CLEANTABLE

例如:

DBCC CLEANTABLE (Databasename,'tablename', 0)
WITH NO_INFOMSGS;