现在的位置: 首页 > 综合 > 正文

SQL里的SWITCH分支语句

2012年07月20日 ⁄ 综合 ⁄ 共 135字 ⁄ 字号 评论关闭

 

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

 

 

抱歉!评论已关闭.