We have discussed how to tune a CASE expression SQL with hardcoded literals in my last blog:
How to Tune SQL Statement with CASE Expression for SQL Server I? | Go4Expert
If I change the hardcoded literal to a...
How to Tune SQL Statement with CASE Expression for SQL Server II?
How to Tune SQL Statement with CASE Expression for SQL Server I? | Go4Expert
Code:
SELECT * FROM EMPLOYEE WHERE CASE when emp_id < 1001000 then 'Old Employee' when emp_dept <'B' then 'Old Department' ELSE 'Normal' END = 'Old Employee'
How to Tune SQL Statement with CASE Expression for SQL Server II?