Yahoo Poland Wyszukiwanie w Internecie

Search results

  1. 8 gru 2016 · DECODE(a, b, c, d, e, f) Translates to this standard SQL expression (which can be used starting with SQL Server 2022): CASE WHEN a IS NOT DISTINCT FROM b THEN c WHEN a IS NOT DISTINCT FROM d THEN e ELSE f END In older SQL Server versions, an emulation using EXISTS and INTERSECT is possible:

  2. 23 kwi 2011 · SELECT DECODE(Letters, 'First',1, 'Second',2, 'Third',3, 0) AS LN. FROM LettersTable. In SQL Server the equivalent code is CASE statement. Here are the examples regarding how DECODE can be written in SQL Server. SELECT CASE WHEN Letters = 'First' THEN 1. WHEN Letters = 'Second' THEN 2. WHEN Letters = 'Third' THEN 3. ELSE 0 END AS LN.

  3. www.sqltutorial.org › sql-comparison-functions › sql-decodeSQL DECODE - SQL Tutorial

    SELECT DECODE (3, 1, 'Equal 1,', 2, 'Equal 2', 'Not Equal 1 or 2'); Code language: SQL (Structured Query Language) (sql) This example works like the following IF-THEN-ELSEIF-ELSE statement: IF 3 = 1 THEN RETURN 'Equal 1'; ELSE IF 3 =2 THEN RETURN 'Equal 2'; ELSE RETURN 'Not Equal 1 or 2'; END IF ; Code language: SQL (Structured Query Language ...

  4. You can use 'sign' with a decode. Sign will return -1 for any negative, 0 for 0, and 1 for any positive: select decode(sign(money_return), -1, abs(money_return), 1, money_return*10, money_return) from cash_t; edited Oct 7, 2019 at 14:04.

  5. 2 cze 2015 · Here's a simplified example: DECLARE @T TABLE (id smallint identity, BitMask tinyint); INSERT INTO @T (BitMask) VALUES. (0), (1), (2), (3), (4), (5), (6), (7), (8), (9); SELECT. t.id, t.BitMask, bm.BitNum, bm.Permission. FROM @T t. OUTER APPLY ( SELECT * FROM (VALUES. (t.id, 0, 'Can X'), (t.id, 1, 'Can Y'), (t.id, 2, 'Can Z')

  6. DECODE allows you to compare a value to a set of possible values and return a corresponding result when a match is found. It is often used for data transformation, simplifying complex CASE statements, and providing concise value substitution based on specific conditions.

  7. 6 sie 2024 · This tutorial provides a comprehensive guide to using the SQL DECODE() function in Oracle. I will also compare DECODE() to CASE WHEN in Oracle and help you understand when to use each function. Finally, I will provide code for the equivalent transformations in SQL Server, PostgreSQL, and MySQL.

  1. Ludzie szukają również