Sql server Express 2005 Advanced

Answered Sql server Express 2005 Advanced

  • Thursday, April 27, 2006 5:10 PM
     
     

     

    Have been trying to use an 'iif' statement as a simple expression within a computed column. I cannot get the server to accept the statement. Every variation of commas quotes, spaces within the iif statement produces the same result.  The statement is very simple : iif(Mileage>0, Mileage*.40, 0). The column is of data type 'money' and mileage is a numeric field (within the same table of course)

    I'm in the process of adding data tables into a new database, using Management studio express.

    Could someone please give me a valid example. I have worked with Access Databases for a number of years and am rapidly losing what is left of my hair on this annoying little problem.

    I'm using sql server express 2005 with the advanced features.

    Thanks in advance

     Mikmaq

     

All Replies

  • Thursday, April 27, 2006 6:15 PM
     
     

    There is no IIF in SQL Server. See http://msdn2.microsoft.com/en-us/library/ms181765.aspx for what you should use instead of IIF.

    Thanks
    Laurentiu

  • Thursday, April 27, 2006 6:27 PM
     
     Answered

    Thanks Laurentiu.

     It didn't do my ego any good, but it does explain the problem. Perhaps it might be an idea to reflect this in some of the support documentation for sql on the microsoft web, that still refers to 'iif' expressions.

    Have a good one