About 310,000 results
Open links in new tab
  1. How do I perform an IF...THEN in an SQL SELECT?

    Sep 15, 2008 · The CASE statement is the closest to IF in SQL and is supported on all versions of SQL Server. SELECT CAST( CASE WHEN Obsolete = 'N' or InStock = 'Y' THEN 1 ELSE 0 …

  2. SQL Case Expression Syntax? - Stack Overflow

    Aug 7, 2008 · case expression is the correct term as they evaluate to a scalar value (also. in SQL a statement is terminated by the "statement terminator" which is the semi-colon).

  3. SQL Server CASE .. WHEN .. IN statement - Stack Overflow

    May 18, 2011 · On SQL server 2005 I am trying to query this select statement SELECT AlarmEventTransactionTableTable.TxnID, CASE AlarmEventTransactions.DeviceID WHEN …

  4. SQL Switch/Case in 'where' clause - Stack Overflow

    Oct 16, 2008 · SQL Switch/Case in 'where' clause Asked 17 years ago Modified 2 years, 8 months ago Viewed 795k times

  5. sql - Case statement with 'OR' statement - Stack Overflow

    Oct 25, 2012 · Note that in SQL, string comparison is case-insensitive by default. You can alter the default by setting a case-sensitive database collation, but that's fairly unusual.

  6. sql - Case in Select Statement - Stack Overflow

    Jan 7, 2013 · I have an SQL statement that has a CASE from SELECT and I just can't get it right. Can you guys show me an example of CASE where the cases are the conditions and the …

  7. SQL- Ignore case while searching for a string - Stack Overflow

    Apr 18, 2013 · I have the following data in a Table PriceOrderShipped PriceOrderShippedInbound PriceOrderShippedOutbound In SQL I need to write a query which searches for a string in a …

  8. How do I do multiple CASE WHEN conditions using SQL Server …

    How do I do multiple CASE WHEN conditions using SQL Server 2008? Asked 12 years, 9 months ago Modified 3 years, 3 months ago Viewed 1.7m times

  9. Best way to do nested case statement logic in SQL Server

    I'm writing an SQL Query, where a few of the columns returned need to be calculated depending on quite a lot of conditions. I'm currently using nested case statements, but its getting messy. …

  10. SQL Case statement with 'or' and 'and' - Stack Overflow

    Apr 26, 2014 · Can I use a case statement as follows? CASE WHEN (condition1 = 1 or 2) AND condition2 = 3 THEN result = 'Result' ELSE NULL END Conditions 1 and 2 will be looking for …