当前位置: 代码迷 >> ASP.NET >> 存储过程中关于case-when-then 的用法有关问题?
  详细解决方案

存储过程中关于case-when-then 的用法有关问题?

热度:2107   发布时间:2013-02-25 00:00:00.0
存储过程中关于case--when---then 的用法问题????
case(kbn)
when(1 or 2 or 3 or 4)
then
  set @falg=true
end


这样写条件可以吗?为什么保存时老提示出错阿?????

------解决方案--------------------------------------------------------
你用的是sql 数据库吗 如果是 

case kbn 
when 1 or 2 or 3 or 4 
then 
set @falg=true 
end 

------解决方案--------------------------------------------------------
貌似没有这么用的吧
case子句应该用在其他子句内 不能够这样单独使用。
------解决方案--------------------------------------------------------
Select * case(kbn)..........
------解决方案--------------------------------------------------------
select case( Column ) 
when 1 or 2 or 3 or 4 or 5
then expression
END
FROM TableName

 
------解决方案--------------------------------------------------------
set @falg=true 
这里错了 !不能这样用!!
  相关解决方案