November 6, 2002 at 10:59 am
Can the WHEN part of a CASE statement contain an OR clause? If so, what is the proper syntax?
November 6, 2002 at 11:03 am
Yes.
Here is an example:
use pubs
go
select case when city = 'Oakland' or city = 'Menlo Park'
then 'Change City'
else city
end
from authors
Gregory Larsen, DBA
If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples
Gregory A. Larsen, MVP
November 6, 2002 at 11:07 am
Perfectly legitimate.
Here is another example
SELECT CASE WHEN CONVERT(CHAR,GETDATE(),101) = '11/06/2002' OR DATEPART(dw,GETDATE()) = 3 THEN 'YES' ELSE 'NOPE' END
November 6, 2002 at 11:08 am
yes! that's it. thank you
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply