Re: IIF in SQL server
From: Hugo Kornelis (hugo_at_pe_NO_rFact.in_SPAM_fo)
Date: 10/27/04
- Next message: rdbrock: "Re: SQL Query Analyzer does not open"
- Previous message: Hugo Kornelis: "Re: Get the smallest timespan between two entries"
- In reply to: MichaelK: "IIF in SQL server"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 27 Oct 2004 23:30:13 +0200
On Wed, 27 Oct 2004 12:51:12 -0700, MichaelK wrote:
>Is there a way in SQL Server to run the simple query
>having something like IIF function in Access.
>Similar to this easy query.
>
>SELECT Mobile,iif([PlanType]=1, "New", "Upgrade") As Type FROM Acts WHERE
>(RepId = 2194)
>
>Thanks,
>Michael
>
Hi Michael,
SELECT Mobile,
CASE
WHEN PlanType = 1
THEN 'New'
ELSE 'Upgrade'
END AS Type
FROM Acts
WHERE RepId = 2194
Best, Hugo
-- (Remove _NO_ and _SPAM_ to get my e-mail address)
- Next message: rdbrock: "Re: SQL Query Analyzer does not open"
- Previous message: Hugo Kornelis: "Re: Get the smallest timespan between two entries"
- In reply to: MichaelK: "IIF in SQL server"
- Messages sorted by: [ date ] [ thread ]