About 179,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.

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

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

  4. SQL WITH clause example - Stack Overflow

    Sep 23, 2012 · The name assigned to the sub-query is treated as though it was an inline view or table. The SQL WITH clause is basically a drop-in replacement to the normal sub-query. …

  5. CASE .. WHEN expression in Oracle SQL - Stack Overflow

    SELECT status, CASE status WHEN 'a1' THEN 'Active' WHEN 'a2' THEN 'Active' WHEN 'a3' THEN 'Active' WHEN 'i' THEN 'Inactive' WHEN 't' THEN 'Terminated' END AS StatusText …

  6. Nested select statement in SQL Server - Stack Overflow

    Check for more subquery rules and subquery types. More examples of Nested Subqueries. IN / NOT IN – This operator takes the output of the inner query after the inner query gets executed …

  7. SQL Server Insert Example - Stack Overflow

    46 I switch between Oracle and SQL Server occasionally, and often forget how to do some of the most trivial tasks in SQL Server. I want to manually insert a row of data into a SQL Server …

  8. sql - Oracle - Merge Statement with INSERT and UPDATE - Stack …

    Dec 16, 2020 · I have an existing table called TextData with fields TextId and Text. In below statement, I am trying to merge (Insert/Update) some records into this table using - MERGE …

  9. sql - sqlplus statement from command line - Stack Overflow

    Just be aware that on Unix/Linux your username/password can be seen by anyone that can run "ps -ef" command if you place it directly on the command line . Could be a big security issue …

  10. How do I create a parameterized SQL query? Why Should I?

    One advantage is that you can repeat an insert many times with one prepared statement, gaining a speed advantage. For instance, in the above query I could prepare the statement once, and …