Monday, 28 July 2014

Use of case in where clause

SELECT * 
FROM    tableName
WHERE   dateCol =   CASE WHEN @considerDate =1
                         THEN @date 
                         ELSE dateCol 
                    END

No comments:

Post a Comment