IF测试可以嵌套在另一个IF或之后ELSE。 嵌套级数的限制取决于可用内存。 示例 SQL IF DATENAME(weekday, GETDATE()) IN (N'Saturday', N'Sunday')SELECT'Weekend'; ELSESELECT'Weekday'; 有关更多示例,请参阅ELSE (IF...ELSE)。 示例:Azure Synapse Analytics 和 Analytics Platform System (PDW) ...
ELSE (IF...ELSE) (Transact-SQL)指定Transact-SQL 语句的执行条件。如果 Boolean_expression 取值为 TRUE,则执行 Boolean_expression 后的 Transact-SQL 语句 (sql_statement)。当 Boolean_expression 取值为 FALSE 或 NULL 时,可选 ELSE 关键字为要执行的 Transact-SQL 语句。 Transact-SQL 语法约定 语法 复制...
IF 1 = 1 PRINT 'Boolean expression is true.' ELSE PRINT 'Boolean expression is false.'; 下列範例具有布爾表達式 (1 = 2) 為 false,因此會列印第二個語句。 SQL IF 1 = 2 PRINT 'Boolean expression is true.' ELSE PRINT 'Boolean expression is false.'; GO ...
exécutée si la condition est remplie, c'est-à-dire lorsque l'expression booléenne retourne la valeur TRUE. Le mot clé facultatif ELSE introduit une autre instruction Transact-SQL qui est exécutée lorsque la condition IF n'est pas remplie : l'expression booléenne retourne alors la ...
IF 1 = 1 PRINT 'Boolean_expression is true.' ELSE PRINT 'Boolean_expression is false.' ; Вследующемпримерепростоелогическоевыражение (1=2) имеетзначение false, поэтомупечатаетсявтораяин...
AnIF...ELSEconstruct can be used in batches, in stored procedures, and in ad hoc queries. When this construct is used in a stored procedure, it's usually to test for the existence of some parameter. IFtests can be nested after anotherIFor following anELSE. The limit to the number of...
AnIF...ELSEconstruct can be used in batches, in stored procedures, and in ad hoc queries. When this construct is used in a stored procedure, it's usually to test for the existence of some parameter. IFtests can be nested after anotherIFor following anELSE. The limit to the number of...
The Transact-SQL statement that follows an IF keyword and its condition is executed if the condition is satisfied: the Boolean expression returns TRUE. The optional ELSE keyword introduces another Transact-SQL statement that is executed when the IF condition is not satisfied: the Boolean expression ...
DBCC results for 'model'. CHECKDB found 0 allocation errors and 0 consistency errors in database 'master'. DBCC execution completed. If DBCC printed error messages, contact your system administrator. 如果指定了DBCC CHECKDB,则ESTIMATEONLY返回以下结果集。
运行时编译的 Transact-SQL 语句可能会向恶意攻击公开应用程序。 使用sp_executesql时应参数化查询。 有关详细信息,请参阅SQL 注入。 Transact-SQL 语法约定 语法 SQL Server、Azure SQL 数据库、Azure SQL 托管实例、Azure Synapse Analytics 和 Analytics Platform System(PDW)的语法。