• Sean Lange (5/7/2014)


    How about this?

    SELECT [Columns]

    FROM Test1 T1

    INNER JOIN Test2 T2 ON T1.ID = T2.ID

    WHERE CASE @p_flag

    WHEN 1 THEN moveFlag = 26

    ELSE moveFlag > 26 OR moveFlag < 26

    END

    how did you make this work? I copied and pasted this into SSMS, set up test tables but it won't parse. I get:

    Msg 102, Level 15, State 1, Line 3

    Incorrect syntax near '='.