
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 …
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?
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.
Login to Microsoft SQL Server Error: 18456 - Stack Overflow
Jul 8, 2016 · I am getting this error while trying to connect to the SQL Server. Microsoft SQL Server Error: 18456 Can anybody tell me what the error code means?
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 …
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, …
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 …
SQL to find the number of distinct values in a column
Apr 5, 2019 · SQL to find the number of distinct values in a column Asked 17 years, 2 months ago Modified 2 years, 7 months ago Viewed 826k times
How to convert a datetime to string in T-SQL - Stack Overflow
Feb 22, 2013 · 19 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 …
SQL Replace multiple different characters in string
Aug 30, 2016 · SQL Replace multiple different characters in string Asked 9 years, 3 months ago Modified 1 year, 4 months ago Viewed 224k times