Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
milo.cabs
Starting Member
1 Post |
Posted - 2012-05-11 : 02:47:07
|
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 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2012-05-11 : 15:21:06
|
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. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-05-11 : 15:39:39
|
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 MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|