SQL Server 2005 query that uses the IIF with style date bool ? RRS feed

  • Question

  • Suppose I have TABLE with the following fields:
    Quantity [number]
    Price [Number]
    Returns [bool]

    If Returns = true, then - ([quantity]*[Price])// negative returns
    If Returns = false, then ([quantity]*[Price]) // positive returns

    Question using SQL Server 2005:
    Inquiry following his error was in command IIF:
    SELECT quantity, Price, Returns, IIF ([Returns] = 0, ([quantity]*[Price]), (-1)*([quantity]*[Price])) As Total

    SQL Syntax Errors Encountered:
    The following errors were encountered while parsing the contents of the SQL pane:
    Error in list of function arguments: '=' not recognized. Unable to parse query text.
    Sunday, June 12, 2016 8:43 AM