What is the equivalent of the IIF command in SQL Server?

Neil Pike

February 4, 2000

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A. In Microsoft Access you would use:

Select iif(field>10,"large", "small") as Size from Table

With SQL Server, use the CASE command

SELECT Size = 
CASE
WHEN field > 10 THEN "large"
ELSE "small"
END
from Table

See also, "Enabling .NET on SQL Server" and "More SQL Server Tools."

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like