• CELKO (7/18/2011)


    SIGN (1 + SIGN(x)) * x

    but it means using x twice. Hide it in a CTE and use the twice.

    CTEs generally don't help - the expression is evaluated twice.

    I included the TOP trick as the only way I know to force the query processor to evaluate just once.