SQL里的SWITCH分支语句
declare @i int
declare @j varchar(10)
set @i=1
select @j=
case @i
when 1 then '11'
when 2 then '22'
when 3 then '33'
else 'other'
end
print @j
declare @j varchar(10)
set @i=1
select @j=
case @i
when 1 then '11'
when 2 then '22'
when 3 then '33'
else 'other'
end
print @j