Hi.. wanted to know if what performs better in terms of execution time.. a CASE WHEN 1 THEN "<STRING>" WHEN 2 THEN "<STRING>" or just creating another table with CODE and DESC and map it on query.. thanks
You should try both see what happens. There is a good chance that just using a CASE expresson is going to perform faster than using a "lookup" domain table. But, I doubt it'll be much of a difference. Additionally, if you are going to do this "translation" on any sort of regular basis, a domain table is the correct answer.
It depends on scenario. If its an adhoc one time mapping i would go for a CASE statement but if its a natural ID description mapping and its frequently used I would go for a mapping table which enables us to modify (add/remove/change) values based on our requirement and doesnt need to tweak CASE WHEN for each change of value pair
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/