How do I perform an IF…THEN in an SQL SELECT?
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 END AS bit) as Saleable, * FROM Product You only need to use the CAST operator if you want the result as a … Read more