引用早前帖子的内容:
新问题!昨天的问题解决了,谢谢版主们!今天再加了一个语句(红色字体)后出现错误提示!请教怎么回事?
SQL语句:
SELECT TOP 100 PERCENT BOM1.父件货号 AS A0, BOM1.父件货名 AS A0货名,
BOM1.父件存货类型, BOM1.父件工序 AS A0工序, BOM1.子件货号 AS A1,
BOM1.子件货名 AS A1货名, BOM1.子件工序 AS A1工序, BOM1.用量,
BOM2.子件货号 AS A2, BOM2.子件货名 AS A2货名, BOM2.子件工序 AS A2工序,
BOM3.子件货号 AS A3, BOM3.子件货名 AS A3货名, BOM3.子件工序 AS A3工序,
BOM4.子件货号 AS A4, BOM4.子件货名 AS A4货名, BOM4.子件工序 AS A4工序,
BOM5.子件货号 AS A5, BOM5.子件货名 AS A5货名, BOM5.子件工序 AS A5工序,
BOM6.子件货号 AS A6, BOM6.子件货名 AS A6货名, BOM6.子件工序 AS A6工序,
BOM7.子件货号 AS A7, BOM7.子件货名 AS A7货名, BOM7.子件工序 AS A7工序,
LEFT(ISNULL(BOM1.父件货号 + '\', '') + ISNULL(BOM1.子件货号 + '\', '')
+ ISNULL(BOM2.子件货号 + '\', '') + ISNULL(BOM3.子件货号 + '\', '')
+ ISNULL(BOM4.子件货号 + '\', '') + ISNULL(BOM5.子件货号 + '\', '')
+ ISNULL(BOM6.子件货号 + '\', '') + ISNULL(BOM7.子件货号 + '\', ''),
LEN(ISNULL(BOM1.父件货号 + '\', '') + ISNULL(BOM1.子件货号 + '\', '')
+ ISNULL(BOM2.子件货号 + '\', '') + ISNULL(BOM3.子件货号 + '\', '')
+ ISNULL(BOM4.子件货号 + '\', '') + ISNULL(BOM5.子件货号 + '\', '')
+ ISNULL(BOM6.子件货号 + '\', '') + ISNULL(BOM7.子件货号 + '\', '')) - 1) AS 工艺链,
LEFT(ISNULL(BOM1.子件工序 + '\', '') + ISNULL(BOM2.子件工序 + '\', '')
+ ISNULL(BOM3.子件工序 + '\', '') + ISNULL(BOM4.子件工序 + '\', '')
+ ISNULL(BOM5.子件工序 + '\', '') + ISNULL(BOM6.子件工序 + '\', '')
+ ISNULL(BOM7.子件工序 + '\', ''), LEN(ISNULL(BOM1.子件工序 + '\', '')
+ ISNULL(BOM2.子件工序 + '\', '') + ISNULL(BOM3.子件工序 + '\', '')
+ ISNULL(BOM4.子件工序 + '\', '') + ISNULL(BOM5.子件工序 + '\', '')
+ ISNULL(BOM6.子件工序 + '\', '') + ISNULL(BOM7.子件工序 + '\', '')) - 1)
AS 工序链
FROM dbo.wu_bom_no_工艺链 BOM7 RIGHT OUTER JOIN
dbo.wu_bom_no_工艺链 BOM6 ON
BOM7.父件货号 = BOM6.子件货号 RIGHT OUTER JOIN
dbo.wu_bom_no_工艺链 BOM5 ON
BOM6.父件货号 = BOM5.子件货号 RIGHT OUTER JOIN
dbo.wu_bom_no_工艺链 BOM4 ON
BOM5.父件货号 = BOM4.子件货号 RIGHT OUTER JOIN
dbo.wu_bom_no_工艺链 BOM3 ON
BOM4.父件货号 = BOM3.子件货号 RIGHT OUTER JOIN
dbo.wu_bom_no_工艺链 BOM2 ON
BOM3.父件货号 = BOM2.子件货号 RIGHT OUTER JOIN
dbo.wu_bom_no_工艺链 BOM1 ON BOM2.父件货号 = BOM1.子件货号
ORDER BY BOM1.父件货号 DESC
错误提示:"substring函数传递了无效的length参数"
图片附件: 游客没有浏览图片的权限,请
登录 或
注册
补充说明:“子件工序”列的内容为中文,而“货号”列的内容是数字加字符,
是因为格式不同的原因吗?
谢谢!