sql 中if、case、while 语法格式
2012-02-08 15:51
176 查看
---if语句 declare @ret bit set @ret=1 --0 if @ret=1 begin print 'true' end else begin print 'false and null' end ---多条选择语句 DECLARE @iRet INT, @PKDisp VARCHAR(20) SET @iRet = 1 -- set @PKDisp='五' Select @iRet = CASE WHEN @PKDisp = '一' THEN 1 WHEN @PKDisp = '二' THEN 2 WHEN @PKDisp = '三' THEN 3 WHEN @PKDisp = '四' THEN 4 WHEN @PKDisp = '五' THEN 5 ELSE 100 END print @iRet --while 循环语句 declare @i int set @i =1 while @i<5 begin set @i=@i+1 print @i--每次循环的值都输出 end print @i--输出最后结果值
相关文章推荐
- 基础语法(if while case for continue exit try)
- Sql语句:IF ELSE CASE WHEN WHILE CONTINUE BREAK
- Shell 语法 if 、 case 、for 、 while、 until 、select 、repeat、子函数
- linux shell学习 记录2 if elif case for while until 语法
- sql server while, case,if..else ... try catch ..对象
- shell if,case,for,while语法
- linux shell 流程控制(条件if,循环【for,while】,选择【case】语句实例
- Linux之shell编程条件判断-if,while,for,case
- 题目:求1+2+…+n,要求不能使用乘除法、for、while、if、else、switch、case等关键字以及条件判断语句(A?B:C)。
- SQL中的IF ELSE(CASE语句的使用)
- SQL if exists database总是出现语法错误
- 求1+2+3+...+n,要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)
- T_sql中的while 和if
- shell语法之case; if 语句
- hive中使用case、if:一个region统计业务(hive条件函数case、if、COALESCE语法介绍:CONDITIONAL FUNCTIONS IN HIVE)
- C语言奇思妙想:求1+2+…+n,要求不能使用乘除法、for、while、if、else、s witch、case 等关键字以及条件判断语句(A?B:C)
- 流程控制语句,if,for,while,case等
- 3.08课·········switch case及if else嵌套(日期格式)
- SHELL脚本语句 if、for、while、case 图示
- if for while until case select 命令