September 25, 2003 at 7:01 am
I have Access SQL code that I need to transfer to SQL Server SQL. I have many IIF functions in the SQL. Can we use the IIF function from Access in SQL Server or do we have to use CASE or regular IF statements?
Thanks
September 25, 2003 at 7:56 am
There isn't any IIF in SQL Server. Use the CASE statement.
-SQLBill
September 26, 2003 at 3:09 am
I have always found that for complex IIF(expression,truepart,falsepart) statements there is no real alternative but to convert to CASE WHEN expression THEN truepart ELSE falsepart END. However SQL Server does have some functions that work for simple criteria, e.g. ISNULL(expression, replacement), which is the equivalent of Access' Nz() with two argumants and NULLIF(expression1,expression2) which returns NULL if expression1 = expression2.
September 26, 2003 at 12:35 pm
Similar reply like other did - Use CASE statement. Check out the link - Vyas has a nice example.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply