码迷,mamicode.com
首页 > 其他好文 > 详细

if 和case

时间:2017-03-16 19:10:46      阅读:164      评论:0      收藏:0      [点我收藏+]

标签:end   arch   else   cas   null   status   declare   int   case when   

select case ‘O‘
when ‘O‘ then (1*5-6)
when ‘C‘ then (1*5-6)
when ‘EC‘ then (1*5-6)
--else null
--end
--case @loanStatus
when ‘IL‘ then

case when (15-100-80+12)>0 then 15-100 else 0 end
--if (15-100-80+12)>0 then (15-100) else 0 end


end

declare @loanStatus varchar
set @loanStatus=‘O‘
declare @aa int
set @aa=1
if @loanStatus=‘O‘
set @aa=1*5-6
if @loanStatus=‘C‘
set @aa=1*5-6
if @loanStatus=‘EC‘
set @aa=1*5-6
--else null
--end
--case @loanStatus
if @loanStatus=‘IL‘
if(15-100-80+12)>0
set @aa=15-100
else
set @aa=0
select @aa

if 和case

标签:end   arch   else   cas   null   status   declare   int   case when   

原文地址:http://www.cnblogs.com/shuibi/p/6560882.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!