declare @x int @y int @z int select @x = 1 @y = 2 @z=3 if @x > @y print 'x > y' --打印字符串'x > y' else if @y > @z print 'y > z' else print 'z > y' --CASE use pangu update employee set e_wage = case when job_level
declare @x int @y int @z int select @x = 1 @y = 2 @z=3 if @x > @y print 'x > y' --打印字符串'x > y' else if @y > @z print 'y > z' else print 'z > y' --CASE use pangu update employee set e_wage = case when job_level = ’1’ then e_wage*1.08 when j...
DELETE (Transact-SQL) DENSE_RANK (Transact-SQL) DENY (Transact-SQL) DIFFERENCE (Transact-SQL) DISABLE TRIGGER (Transact-SQL) DROP 陳述式 (Transact-SQL) ELSE (IF...ELSE) (Transact-SQL) ENABLE TRIGGER (Transact-SQL) ENCRYPTBYASYMKEY (Transact-SQL) ...
Applies to: SQL Server 2019 (15.x) and later versions. Specifies thatcommand_stringis executed againstdata_source_nameand results, if any, are returned to the client.data_source_namemust refer to an existingEXTERNAL DATA SOURCEdefinition in the database. Only data sources that point to SQL ...
Applies to: SQL Server 2019 (15.x) and later versions. Specifies thatcommand_stringis executed againstdata_source_nameand results, if any, are returned to the client.data_source_namemust refer to an existingEXTERNAL DATA SOURCEdefinition in the database. Only data sources that point to SQL ...
TRANSACTION_ID bigint START: NOT NULLEND: NULL Applies to: SQL Server 2022 (16.x) and later, and Azure SQL Database.The ID of the transaction that creates (START) or invalidates (END) a row version. If the table is a ledger table, the ID references a row in the sys.database_led...
END TRY BEGIN CATCH -- Check error number. -- If deadlock victim error, -- then reduce retry count -- for next update retry. -- If some other error -- occurred, then exit -- retry WHILE loop. IF (ERROR_NUMBER() = 1205) SET @retry = @retry - 1; ELSE SET @retry = -1; -...
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_...
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 ...
Transact-SQL language reference for IF-ELSE statements to provide control flow in Transact-SQL statements.