The SQL IIF function is the new built-in Logical function introduced in SQL Server 2012. We can consider the SQL Server IIF as the shorthand way of writing IF Else, and CASE statements. SQL Server IIF function will accept three arguments. The first argument is the Boolean expression, which returns true or false.

Furthermore, how do you write a case statement in SQL? The SQL CASE Statement The CASE statement goes through conditions and returns a value when the first condition is met (like an IF-THEN-ELSE statement). So, once a condition is true, it will stop reading and return the result. If no conditions are true, it returns the value in the ELSE clause.

Moreover, can we use if condition in where clause in SQL?

SQL SERVER – How to use if… else in where clause. IF… ELSE clause is very handy and whenever you need to perform any conditional operation, you can achieve your results using it. But there are some limitations in IF… ELSE, and one of the limitations is that you cannot use it in WHERE clause.

Why we use begin and end in SQL?

BEGIN and END are used in Transact-SQL to group a set of statements into a single compound statement, so that control statements such as IF … ELSE, which affect the performance of only a single SQL statement, can affect the performance of the whole group.