Transact-SQL reference for the CASE expression. CASE evaluates a list of conditions to return specific results.
The CASE expression cannot be used to control the flow of execution of Transact-SQL statements, statement blocks, user-defined functions, and stored procedures. For a list of control-of-flow methods, seeControl-of-Flow Language (Transact-SQL). Examples A. Using a SELECT statement with a simpl...
Transact-SQL reference for the CASE expression. CASE evaluates a list of conditions to return specific results.
Transact-SQL SELECT BusinessEntityID, LastName, TerritoryName, CountryRegionName FROM Sales.vSalesPerson WHERE TerritoryName IS NOT NULL ORDER BY CASE CountryRegionName WHEN 'United States' THEN TerritoryName ELSE CountryRegionName END; E. Using CASE in an UPDATE statement ...
For more information, see Data Type Precedence (Transact-SQL). Return Values Simple CASE expression: The simple CASE expression operates by comparing the first expression to the expression in each WHEN clause for equivalency. If these expressions are equivalent, the expression in the THEN clause ...
CASE (Transact-SQL) A. 使用带有 CASE 简单表达式的 SELECT 语句 Using a SELECT statement with a simple CASE expression 在SELECT 语句中,CASE 简单表达式只能用于等同性检查,而不进行其他比较。 下面的示例使用 CASE 表达式更改产品系列类别的显示,以使这些类别更易于理解。
Transact-SQL reference for the CASE expression. CASE evaluates a list of conditions to return specific results.
The SQL CASE Expression TheCASEexpression goes through conditions and returns a value when the first condition is met (like an if-then-else statement). So, once a condition is true, it will stop reading and return the result. If no conditions are true, it returns the value in theELSE...
Transact-SQL reference for the CASE expression. CASE evaluates a list of conditions to return specific results.
从他的阶梯到t - sql DML,Gregory Larsen涵盖了t - sql语言的更高级的方面,如子查询。 There are times where you need to write a single TSQL statement that is able to return different TSQL expressions based on the evaluation of another expression. When you need this kind of functionality you ca...