2

我被卡住了,我无法弄清楚。有没有人有任何想法?我将不胜感激任何帮助。

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

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

消息 511,级别 16,状态 1,行 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。我很沮丧... :-(

4

2 回答 2

0

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

于 2013-09-23T23:58:51.983 回答
0

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

DBCC CLEANTABLE

例如:

DBCC CLEANTABLE (Databasename,'tablename', 0)
WITH NO_INFOMSGS;
于 2016-02-18T13:33:20.927 回答