
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 …
How do I perform an IF...THEN in an SQL SELECT?
Sep 15, 2008 · 2059 The CASE statement is the closest to IF in SQL and is supported on all versions of SQL Server.
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 …
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
Convert Month Number to Month Name Function in SQL
Oct 9, 2008 · SQL Server nowadays can get the ordinalnummer of a comma separated value of values, using the STRING_SPLIT function Also the names of the month are already stored in …
sql - Incorrect syntax near '' - Stack Overflow
SELECT TOP 1000 * FROM master.sys.procedures as procs left join master.sys.parameters as params on procs.object_id = params.object_id This seems totally correct, but I keep getting …
SQL - Select first 10 rows only? - Stack Overflow
Dec 12, 2009 · How do I select only the first 10 results of a query? I would like to display only the first 10 results from the following query: SELECT a.names, COUNT(b.post_title) AS num FROM
How to select unique records by SQL - Stack Overflow
How to select unique records by SQL Asked 16 years ago Modified 1 year, 10 months ago Viewed 746k times
SQL Server tables: what is the difference between @, # and
Feb 8, 2010 · In SQL Server, what is the difference between a @ table, a # table and a ## table?
How do I rename a column in a database table using SQL?
Oct 6, 2008 · 155 If I wish to simply rename a column (not change its type or constraints, just its name) in an SQL database using SQL, how do I do that? Or is it not possible? This is for any …