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

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

  2. SQL: IF clause within WHERE clause - Stack Overflow

    Sep 18, 2008 · Is it possible to use an IF clause within a WHERE clause in MS SQL? Example: WHERE IF IsNumeric(@OrderNumber) = 1 OrderNumber = @OrderNumber ELSE OrderNumber LIKE '%' + @

  3. SQL JOIN: what is the difference between WHERE clause and ON clause?

    SQL INNER JOIN The SQL JOIN clause allows you to associate rows that belong to different tables. For instance, a CROSS JOIN will create a Cartesian Product containing all possible combinations of …

  4. Remove all spaces from a string in SQL Server - Stack Overflow

    May 3, 2012 · What is the best way to remove all spaces from a string in SQL Server 2008? LTRIM(RTRIM(' a b ')) would remove all spaces at the right and left of the string, but I also need to …

  5. sql server - SQL MAX of multiple columns? - Stack Overflow

    Mar 8, 2012 · How do you return 1 value per row of the max of several columns: TableName [Number, Date1, Date2, Date3, Cost] I need to return something like this: [Number, Most_Recent_Date, Cost] …

  6. SQL to find the number of distinct values in a column

    SQL to find the number of distinct values in a column Asked 17 years, 1 month ago Modified 2 years, 7 months ago Viewed 825k times

  7. sql - Delete duplicate rows keeping the first row - Stack Overflow

    10 To delete the duplicate rows from the table in SQL Server, you follow these steps: Find duplicate rows using GROUP BY clause or ROW_NUMBER () function. Use DELETE statement to remove the …

  8. sql - Selecting COUNT (*) with DISTINCT - Stack Overflow

    In SQL Server 2005 I have a table cm_production that lists all the code that's been put into production. The table has a ticket_number, program_type, program_name and push_number along with some ot...

  9. sql - Exclude a column using SELECT * [except columnA] FROM tableA ...

    We all know that to select all columns from a table, we can use SELECT * FROM tableA Is there a way to exclude column(s) from a table without specifying all the columns? SELECT * [except columnA]...

  10. sql server - Database stuck in "Restoring" state - Stack Overflow

    Ran into a similar issue while restoring the database using SQL server management studio and it got stuck into restoring mode. After several hours of issue tracking, the following query worked for me.