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)
 ELSE

Author  Topic 

chipembele
Posting Yak Master

106 Posts

Posted - 2008-01-21 : 05:51:38
Hi
I've got the following

(CASE WHEN [Code] = 'WBWFT' OR [Code] = 'WBPLAS' THEN 'Friday 7th March 2008 from 9:30am to 3:30pm. ' ELSE ' Thursday 6th March 2008 from 10:00am to 1:00pm. ' END)

I need to change the above statement as the parameters have changed to something like this but am struggling with the ELSE. Do I need ELSE IF?

This is what I need it to do.

WHEN the Code is 'WBFT' OR the code is 'WBPLAS' then Friday 7th March from 9:30am to 3:30pm

ELSE

WHEN the Code is 'WBPLMB' then Thursday 6th March 2008 from 10:00am to 1:00pm.

ELSE

WHEN the Code is 'WBCJ' then Wednesday 5th March 2008 from 10:00am to 3:00pm.


Can anyone help me please?

Thanks
Dan

sunil
Constraint Violating Yak Guru

282 Posts

Posted - 2008-01-21 : 05:58:02
Try using following

CASE
WHEN [Code] = 'WBWFT' OR [Code] = 'WBPLAS' THEN 'Friday 7th March 2008 from 9:30am to 3:30pm. '
WHEN [Code] = 'WBPLMB' THEN 'Thursday 6th March 2008 from 10:00am to 1:00pm '
WHEN [Code]='WBCJ' THEN 'Wednesday 5th March 2008 from 10:00am to 3:00pm'
END
Go to Top of Page

chipembele
Posting Yak Master

106 Posts

Posted - 2008-01-21 : 06:20:28
Thankyou Sunil

Didnt realise it was as simple as that.

Regards
Daniel
Go to Top of Page
   

- Advertisement -