Control flow statements in Sqlservre

Source: Internet
Author: User
Tags case statement

Control flow statements in SQL Server

Control flow statements in SQL Server:

IF ... ElSE

Goto

While

WAITFOR

Try/catch

Case

The method that will be used to buy the constituent block: Start with the BEGIN statement and end with the ending statement. (Can be nested)

About the case statement:

Simple Case statement:

< yo "http://www.2cto.com/kf/ware/vc/" target= "_blank" class= "Keylink" >vcd4kpha+y9hl90nbu0xt777ko7o8l3a+ cjxwpjxpbwcgc3jjpq== "Http://www.2cto.com/uploadfile

/collfiles/20140408/20140408090625151.png "alt=" ">

Search for the difference between a case statement and a simple case statement:

1. There is no input expression (that is, the case keyword and the part between the first when).

2. When the expression must be judged to be a Boolean value (instead of having multiple judgements).

SQL Server's judgment Note point:

1. Even if two conditions are judged to be true, only the first condition is used.

2. A field that can be used in a combination of conditional expressions.

3. Any expression can be executed, as long as it is finally judged to be a Boolean result.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.