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.