About 20,800,000 results
Open links in new tab
  1. sql - NOT IN vs NOT EXISTS - Stack Overflow

    Which of these queries is the faster? NOT EXISTS: SELECT ProductID, ProductName FROM Northwind..Products p WHERE NOT EXISTS ( SELECT 1 FROM Northwind..[Order Details] …

  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 …

  3. sql - Concatenate text from multiple rows into a single text string ...

    Consider a database table holding names, with three rows: Peter Paul Mary Is there an easy way to turn this into a single string of Peter, Paul, Mary?

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

  5. sql - Copy data into another table - Stack Overflow

    How to copy/append data from one table into another table with same schema in SQL Server? Edit: let's say there is a query select * into table1 from table2 where 1=1 which creates table1 …

  6. sql - What is the difference between JOIN and INNER JOIN

    SELECT * FROM table INNER JOIN otherTable ON table.ID = otherTable.FK Is there any difference between the statements in performance or otherwise? Does it differ between …

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

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

    Apr 5, 2019 · I can select all the distinct values in a column in the following ways: SELECT DISTINCT column_name FROM table_name; SELECT column_name FROM table_name …

  9. sql - What is a stored procedure? - Stack Overflow

    What is a "stored procedure" and how do they work? What is the make-up of a stored procedure (things each must have to be a stored procedure)?

  10. How to convert a datetime to string in T-SQL - Stack Overflow

    Feb 22, 2013 · In addition to the CAST and CONVERT functions in the previous answers, if you are using SQL Server 2012 and above you use the FORMAT function to convert a DATETIME …