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

    Sep 15, 2008 · Both IIF() and CASE resolve as expressions within a SQL statement and can only be used in well-defined places. The CASE expression cannot be used to control the flow of …

  2. SQL WITH clause example - Stack Overflow

    Sep 23, 2012 · The SQL WITH clause was introduced by Oracle in the Oracle 9i release 2 database. The SQL WITH clause allows you to give a sub-query block a name (a process also …

  3. sql server - SQL: IF clause within WHERE clause - Stack Overflow

    Sep 18, 2008 · This solution is actually the best one due to how SQL server processes the boolean logic. CASE statements in where clauses are less efficient than boolean cases since …

  4. sql - How to use "and" and "or" in a "Where" clause - Stack Overflow

    Jul 23, 2012 · It looks like you are missing one set of brackets: SELECT Store_Id , Paid_Out_Amount , Paid_Out_Comment , Paid_Out_Datetime , Update_UserName , …

  5. SQL Server WITH statement - Stack Overflow

    SQL Server WITH statement. Ask Question Asked 10 years, 2 months ago. Modified 10 years, 2 months ago. ...

  6. sql server - How to set variable from a SQL query ... - Stack Overflow

    To ASSIGN variables using a SQL select the best practice is as shown below->DECLARE co_id INT ; ->DECLARE sname VARCHAR(10) ; ->SELECT course_id INTO co_id FROM …

  7. How can I do an UPDATE statement with JOIN in SQL Server?

    To perform an UPDATE statement with a JOIN in SQL Server, you can use the JOIN syntax in combination with the UPDATE statement. Here's an example query that should update the ud …

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

  9. SQL "IF", "BEGIN", "END", "END IF"? - Stack Overflow

    Jan 10, 2012 · IF statements can, by definition, only take a single SQL statement. However, there is a special kind of SQL statement which can contain multiple SQL statements, the BEGIN …

  10. What is the best way to auto-generate INSERT statements for a …

    Results can be unpredictable with huge text columns or SQL Server 2000's sql_variant data types Whenever possible, Use @include_column_list parameter to ommit column list in the INSERT …

Refresh