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 2005 Forums
 Transact-SQL (2005)
 select column based on value passed on in stored

Author  Topic 

magmo
Aged Yak Warrior

558 Posts

Posted - 2007-07-02 : 03:37:00
Hi

I have a table that looks like this...

ID
mName
GB
SE
DE
DK


The GB, SE, DE, DK part is different language for the mName column, is it possible to write a stored procedure that retrieve the correct language column based on what @LanguageType is passed. It would also be great if I could have the GB language as default (that is if no language is available for the the language passed on).

Hope this make sence....

Best Regards

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-07-02 : 03:41:00
yes. you can use case when . . .

case @LanguageType when 'GB' then GB
when 'SE' then SE
. . .
end



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -