zoukankan      html  css  js  c++  java
  • SQL Server流程控制 2,If...Else 语句

    ylbtech-SQL Server:SQL Server-流程控制 2,If...Else 语句

     SQL Server 流程控制中的 If...Else 语句。

    1,If...Else 语句
     1 --=============================================================
     2 -- 1, If...Else语句
     3 -- Desc:If..Else语句是条件判断语句
     4 -- author:ylbtech
     5 -- pubdate:10:39 2012/12/15
     6 --=============================================================
     7 go
     8 
     9 go
    10 --=============================================================
    11 -- 2,Syntax
    12 --=============================================================
    13 If Boolean_expression
    14 {sql_statement|statement_block}
    15 [Else
    16 {sql_statement|statement_block}]
    17 --Remark:该语法解释为:当Boolean_expression为真时,执行If语句块里的语句,否则执行Else语句块里的语句。
    18 
    19 go
    20 --=============================================================
    21 -- 3,Example
    22 -- Desc:查看产品表中名称为“Gorgonzola Telino”的商品单价是否低于20元,将结果输入来。其代码如下。
    23 --=============================================================
    24 use Northwind
    25 go
    26 Declare @price money
    27 
    28 select @price=UnitPrice from Products where ProductName='Gorgonzola Telino'
    29 
    30 if @price<$20
    31 Print 'UnitPrice less than $20'
    32 Else
    33 Print 'UnitPrice greater than $20'
    34 
    35 
    36 go
    37 --=============================================================
    38 -- 4,Operation result
    39 --=============================================================
    40 --UnitPrice less than $20
    warn 作者:ylbtech
    出处:http://ylbtech.cnblogs.com/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    代码重构技术方法
    《算法导论》为什么经典
    BeagleBone Black教训四局:简单LED对照实验
    linux(Ubuntu)安装QQ2013
    ubuntu卸载qq2012
    android弧形进度条,有详细注释的,比较简单
    Android自定义进度条
    AndroidのUI设计研究(一)——自定义ProgressBar
    介绍几个工作开发中封装的好用的android自定义控件
    android自定义viewgroup之我也玩瀑布流
  • 原文地址:https://www.cnblogs.com/ylbtech/p/2832079.html
Copyright © 2011-2022 走看看