Q: Convert IIF to CASE - Help review conversion I would like to ask for help reviewing a conversion I just did taking a piece of VB6 code and turn it to SQL syntax. 
VB6
IIF([Type] = 1, 26, IIF([Type] = 2, 27, 28))

SQL
  CASE 
      WHEN [Type] = 1 THEN 26
      ELSE
          CASE 
              WHEN [Type] = 2 THEN 27
              ELSE 28
          END
  END


A: The conversion is OK,  but could be made nicer. Unlike IIF, case supports multiple cases, so you could save yourself the nesting. Moreover, since all your comparisons are on the [Type] column, this is a great opportunity to use the shorthand syntax:
CASE [Type]
  WHEN 1 THEN 26
  WHEN 2 THEN 27
  ELSE 28
END

