Working with the IIF Statement in T-SQL April 17, 2019 You can use the IIF statement to check quickly for conditions. For example: DECLARE @Spy varchar(20) = ’07’ SELECT IIF(@Spy = ‘007’, ‘Bond, James Bond’, ‘Ernst Stavro Blofeld’) If the