SQL IF DATENAME(weekday, GETDATE()) IN (N'Saturday', N'Sunday')SELECT'Weekend'; ELSESELECT'Weekday'; 有关更多示例,请参阅ELSE (IF...ELSE)。 示例:Azure Synapse Analytics 和 Analytics Platform System (PDW) 下面的示例使用IF...ELSE,根据DimProduct表中各项的权重来决定向用户显示两个响应中的...
指定Transact-SQL 语句的执行条件。如果 Boolean_expression 取值为 TRUE,则执行 Boolean_expression 后的 Transact-SQL 语句 (sql_statement)。当 Boolean_expression 取值为 FALSE 或 NULL 时,可选 ELSE 关键字为要执行的 Transact-SQL 语句。 Transact-SQL 语法约定 语法 复制 IF Boolean_expression { sql_...
SQL IF 1 = 2 PRINT 'Boolean expression is true.' ELSE PRINT 'Boolean expression is false.'; GO B. 부울 식의 일부로 쿼리 사용 다음 예에서는 부울 식의 일부로 쿼리를 실행합니다. 테이블에 절의Product조건을WHERE충...
Imposes conditions on the execution of a Transact-SQL statement. The Transact-SQL statement (sql_statement) following the boolean_expression is executed if the boolean_expression evaluates to TRUE. The optional ELSE keyword is an alternate Transact-SQL statement that is executed when boolean_expression...
ELSE (IF...ELSE) (Transact-SQL) Imposes conditions on the execution of a Transact-SQL statement. The Transact-SQL statement (sql_statement) following the Boolean_expression* *is executed if the Boolean_expression evaluates to TRUE. The optional ELSE keyword is an alternate Transact-SQL statement...
SQL Copy IF 1 = 1 PRINT 'Boolean expression is true.' ELSE PRINT 'Boolean expression is false.'; The following example has a Boolean expression (1 = 2) that is false, and therefore prints the second statement. SQL Copy IF 1 = 2 PRINT 'Boolean expression is true.' ELSE PRINT '...
Control-of-Flow Language (Transact-SQL) Control-of-Flow Language (Transact-SQL) BEGIN...END (Transact-SQL) BREAK (Transact-SQL) CONTINUE (Transact-SQL) ELSE (IF...ELSE) (Transact-SQL) END (BEGIN...END) (Transact-SQL) GOTO (Transact-SQL) IF...ELSE (Transact-SQL) RETURN (Transact-SQL...
EXECUTE--动态地执行SQL 语句 DESCRIBE--描述准备好的查询 ---局部变量 declare@idchar(10) --set @id = '10010001' select@id='10010001' ---全局变量 ---必须以@@开头 --IF ELSE declare@xint@yint@zint select@x=1@y=2@z=3 if@x>@y ...
EXECUTE--动态地执行SQL 语句 DESCRIBE--描述准备好的查询 ---局部变量 declare@idchar(10) --set @id = '10010001' select@id='10010001' ---全局变量 ---必须以@@开头 --IF ELSE declare@xint@yint@zint select@x=1@y=2@z=3 if@x>@y ...
SQL IF DATENAME(weekday, GETDATE()) IN (N'Saturday', N'Sunday')SELECT'Weekend'; ELSESELECT'Weekday'; 有关更多示例,请参阅ELSE (IF...ELSE)。 示例:Azure Synapse Analytics 和 Analytics Platform System (PDW) 下面的示例使用IF...ELSE,根据DimProduct表中各项的权重来决定向用户显示两个响应中的...