if(substring(@guige,2,1)<3 or substring(@guige,2,1)=6) --选取编号中第二个数小于三或是等于6
begincase
WHEN substring(@guige,10,1)=1 THEN set @a = @a+1
WHEN substring(@guige,10,1)=2 THEN set @b = @b+1
endend服务器: 消息 156,级别 15,状态 1,过程 twotype,行 76
在关键字 'case' 附近有语法错误。
服务器: 消息 156,级别 15,状态 1,过程 twotype,行 78
在关键字 'WHEN' 附近有语法错误。
服务器: 消息 156,级别 15,状态 1,过程 twotype,行 103
在关键字 'end' 附近有语法错误。加上ELSE也不行,
begincase
WHEN substring(@guige,10,1)=1 THEN set @a = @a+1
WHEN substring(@guige,10,1)=2 THEN set @b = @b+1
endend服务器: 消息 156,级别 15,状态 1,过程 twotype,行 76
在关键字 'case' 附近有语法错误。
服务器: 消息 156,级别 15,状态 1,过程 twotype,行 78
在关键字 'WHEN' 附近有语法错误。
服务器: 消息 156,级别 15,状态 1,过程 twotype,行 103
在关键字 'end' 附近有语法错误。加上ELSE也不行,
begin IF substring(@guige,10,1)=1
set @a = @a+1
IF substring(@guige,10,1)=2
set @b = @b+1
if(substring(@guige,2,1) <3 or substring(@guige,2,1)=6) --选取编号中第二个数小于三或是等于6
begin
if
begin
substring(@guige,10,1)=1 else set @a = @a+1
end
if
begin
substring(@guige,10,1)=2 else set @b = @b+1
end
end
declare @guige char(5),@a int,@b intif(substring(@guige,2,1) <3 or substring(@guige,2,1)=6) --选取编号中第二个数小于三或是等于6
begin
select
(case WHEN substring(@guige,10,1)=1 THEN @a+1
WHEN substring(@guige,10,1)=2 THEN @b+1
end) as tend