首页 > 其他 > 详细

if 和case

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

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!