',' 附近有语法错误
--根据辅料名ID和采购单号查询采购单 明细(PEDING)表
ALTER proc [dbo].[ERP_GetNumToAccessoryMaterialPEDINGDetail]
@No varchar(50),
@T_AccessoryMaterialName_ID varchar(50)
as
declare @s varchar(8000)
set @s='select
Color as ''PENDING'',
Color as ''顏色'',
Color as ''染廠色號'',
Color as ''規格/型號'''
select @s=@s+', '''+BackUp2+''' =Max(case BackUp2 when '''+BackUp2+''' then SAMPLE else '''' end)'
from T_OrderAccessoryNotice where [No]=@No and T_AccessoryMaterialName_ID=@T_AccessoryMaterialName_ID
exec(@s+',sum(convert(float,SAMPLE)) as 總數 from T_OrderAccessoryNotice where [No]='''+@No+''' and T_AccessoryMaterialName_ID = '''+ @T_AccessoryMaterialName_ID +'''
and SAMPLE<>'' ''
group by Color')
',' 附近有语法错误。 我是连续for循环查的,查到最后一个NO时就出错了,之前的没错。
------最佳解决方案--------------------你是循环调用这个存储过程的,之前结果都没问题?最后的NO 是多少?
------其他解决方案--------------------这个存储过程创建或是修改的语法上是没有发现错误的。
建议在程序中断点调试一下,怀疑你最后循环的数据有问题。
------其他解决方案--------------------代码 别放到 code里 ,粘出来全乱了
------其他解决方案----------------------根据辅料名ID和采购单号查询采购单 明细(PEDING)表
ALTER proc [dbo].[ERP_GetNumToAccessoryMaterialPEDINGDetail]
@No varchar(50),
@T_AccessoryMaterialName_ID varchar(50)
as
declare @s varchar(8000)
set @s='select
Color as ''PENDING'',
Color as ''顏色'',
Color as ''染廠色號'',
Color as ''規格/型號'''
select @s=@s+', '''+BackUp2+''' =Max(case BackUp2 when '''+BackUp2+''' then SAMPLE else '''' end)'
from T_OrderAccessoryNotice where [No]=@No and T_AccessoryMaterialName_ID=@T_AccessoryMaterialName_ID
exec(@s+',sum(convert(float,SAMPLE)) as 總數 from T_OrderAccessoryNotice where [No]='''+@No+''' and T_AccessoryMaterialName_ID = '''+ @T_AccessoryMaterialName_ID +'''
and SAMPLE<>'' ''
group by Color')