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

    Sep 15, 2008 · 2059 The CASE statement is the closest to IF in SQL and is supported on all versions of SQL Server.

  2. 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 …

  3. 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).

  4. 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.

  5. 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

  6. sql - CASE WHEN with OR - Stack Overflow

    Apr 19, 2016 · A constant in the case part (case 'brasil') doesn't make sense and isn't valid in the first place. If it was valid SQL, it wouldn't make sense as you can replace that with a simple …

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

    What I'm trying to do is use more than one CASE WHEN condition for the same column. Here is my code for the query: SELECT Url='', p.ArtNo, p.[Description], ...

  8. sql - Can I use CASE statement in a JOIN condition ... - Stack …

    Apr 21, 2012 · A CASE expression returns a value from the THEN portion of the clause. You could use it thusly: SELECT * FROM sys.indexes i JOIN sys.partitions p ON i.index_id = …

  9. SQL CASE WHEN with multiple AND and OR - Stack Overflow

    Aug 22, 2018 · Can you please tell me if SQL code below makes sense. I am using multiple ANDs and OR in CASE WHEN. Thanks for your help! SELECT id, period, CASE WHEN state = …

  10. 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 …