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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Using CASE vs. lookup table

Author  Topic 

obiwaugh
Starting Member

27 Posts

Posted - 2004-12-22 : 14:22:49
When translating codes to string descriptions (CA to California)

Is it almost always recommended to use the CASE function rather than joining to a lookup table?

Is the performance difference that noticeable?

I know enough to know that I don't know enough.

nr
SQLTeam MVY

12543 Posts

Posted - 2004-12-22 : 14:28:53
Joining to a lookup table makes it more flexible.
You can add and change entries without altering code.
They are also held in one place rather in lots of code.

This will outweigh any performance considerations except in exceptional circumstances.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2004-12-22 : 14:28:53
>>Is it almost always recommended to use the CASE function rather than joining to a lookup table?

I would say just the opposite :)
Go to Top of Page

obiwaugh
Starting Member

27 Posts

Posted - 2004-12-22 : 14:32:20
Thanks for clearing that up.....

I know enough to know that I don't know enough.
Go to Top of Page
   

- Advertisement -