- SQL code
set ANSI_NULLS ONset QUOTED_IDENTIFIER ONGO-- ================================-- ================================ALTER PROCEDURE [dbo].[usp_OQC_BadChart]( @B_Yer varchar(4), @B_Month varchar(2), [email protected]_Type varchar(30), @B_Class char(1))ASif(@B_Class=='1'){select BadContent,count(1) as BNOfrom T_OQC_ProductionPlanwhere Year(OQCTime)[email protected]_Yer and month(OQCTime)[email protected]_Month and BadContent!='无' and Models like 'DVS%'group by BadContent}else{select BadContent,count(1) as BNOfrom T_OQC_ProductionPlanwhere Year(OQCTime)[email protected]_Yer and month(OQCTime)[email protected]_Month and BadContent!='无' and Models like 'DXM%'group by BadContent}
提示错误
消息 102,级别 15,状态 1,过程 usp_OQC_BadChart,第 12 行
'=' 附近有语法错误。
消息 102,级别 15,状态 1,过程 usp_OQC_BadChart,第 18 行
'}' 附近有语法错误。
消息 102,级别 15,状态 1,过程 usp_OQC_BadChart,第 25 行
'}' 附近有语法错误。
------解决方案--------------------
- SQL code
ALTER PROCEDURE [dbo].[usp_OQC_BadChart]( @B_Yer varchar(4), @B_Month varchar(2), [email protected]_Type varchar(30), @B_Class char(1))ASif(@B_Class='1')select BadContent,count(1) as BNOfrom T_OQC_ProductionPlanwhere Year(OQCTime)[email protected]_Yer and month(OQCTime)[email protected]_Month and BadContent!='无' and Models like 'DVS%'group by BadContentelseselect BadContent,count(1) as BNOfrom T_OQC_ProductionPlanwhere Year(OQCTime)[email protected]_Yer and month(OQCTime)[email protected]_Month and BadContent!='无' and Models like 'DXM%'group by BadContent
------解决方案--------------------
- SQL code
declare @i int set @i=1if(@i=1) --用一个等号就行select 'a'