About 1,620,000 results
Open links in new tab
  1. 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 results are from …

  2. sql server - How do I perform an IF...THEN in an SQL SELECT? - Stack ...

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

  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. 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. Is th...

  5. How to convert all UPPER CASE text to Proper Case/Title Case in SQL …

    In SQL Server 2017 and above, you can achieve proper case by combining STRING_SPLIT, a CTE with ROW_NUMBER to maintain word order, and STRING_AGG to reassemble the string.

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

  7. sql server - SQL: How use case and cast in a query? - Stack Overflow

    Aug 23, 2013 · SQL: How use case and cast in a query? Asked 14 years, 8 months ago Modified 12 years, 3 months ago Viewed 121k times

  8. Como usar CASE dentro de WHERE en SQL Server

    tengo la siguiente parte de un procedimiento en sql Server. FROM Personas as p inner join Estados as e on p.EstadoId=e.Id inner join ListaMarketing_Persona as lmpe on p.Id=lmpe.IdPersona in...

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

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

  10. How to use Switch in SQL Server - Stack Overflow

    @RamSingh - there's no switch statement in the SQL language. As others have indicated, you can use a CASE expression, but it has to compute and return a scalar value.