
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. SELECT CAST( CASE WHEN Obsolete = 'N' or InStock = 'Y' THEN 1 ELSE 0 …
sql - Exclude a column using SELECT * [except columnA] FROM …
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 …
sql - How to SELECT FROM stored procedure - Stack Overflow
May 4, 2017 · I have a stored procedure that returns rows: CREATE PROCEDURE MyProc AS BEGIN SELECT * FROM MyTable END My actual procedure is a little more complicated, …
sql - Case in Select Statement - Stack Overflow
Jan 7, 2013 · I have an SQL statement that has a CASE from SELECT and I just can't get it right. Can you guys show me an example of CASE where the cases are the conditions and the …
sql - JOIN two SELECT statement results - Stack Overflow
Is it possible to join the results of 2 sql SELECT statements in one statement? I have a database of tasks where each record is a separate task, with deadlines (and a PALT, which is just an …
Nested select statement in SQL Server - Stack Overflow
Why doesn't the following work? SELECT name FROM (SELECT name FROM agentinformation) I guess my understanding of SQL is wrong, because I would have thought this would return …
sql - How to use index in select statement? - Stack Overflow
Jul 6, 2011 · Lets say in the employee table, I have created an index(idx_name) on the emp_name column of the table. Do I need to explicitly specify the index name in select clause …
SQL: Two select statements in one query - Stack Overflow
Aug 13, 2015 · I want to select information from two SQL tables within one query, the information is unrelated though, so no potential joints exist. An example could be the following setup. …
sql - Update multiple rows using select statement - Stack Overflow
Jun 28, 2012 · Update multiple rows using select statement Asked 13 years, 4 months ago Modified 7 years, 5 months ago Viewed 121k times
sql - Effect of NOLOCK hint in SELECT statements - Stack Overflow
I guess the real question is: If I don't care about dirty reads, will adding the with (NOLOCK) hint to a SELECT statement affect the performance of: the current SELECT statement other transact...