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)
 store procedures and if statements

Author  Topic 

csphard
Posting Yak Master

113 Posts

Posted - 2006-10-24 : 13:08:11
I have a store procedure that returns data.

I want to change the date monday through friday to spanish
Lunes to Viemes if the code is s for spanish.

How can I check this in my store procedure.

In oracle I could use decode. What can I do here

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-10-24 : 13:17:45
Make use of the CASE keyword.
SELECT	CASE
WHEN MyColumn = 'S' THEN MyColumnInSpanish
WHEN MyColumn = 'F' THEN MyColumnInFrench
ELSE MyColumnInEnglish
END AS TranslatedText
FROM MyTable


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

csphard
Posting Yak Master

113 Posts

Posted - 2006-10-24 : 13:57:52
-- you were right
-- Thanks

select language,case language when 'E' then 'Monday to Friday'
when 'S' then 'Lunes to Viemes'
END AS LANGUAGETYPE
from dbo.TestTable
Go to Top of Page
   

- Advertisement -