Is there "IIF" in the SQL dialect of MS-SQL server?

I tried to use "IIF" in the SQL statments of the MS-SQL server 6.5 but the interpreter didn't accept it although it exists in for example MS-Access Dialect is there any function replaces the "IIF" or the "IIF"  idea is inhibited completelly in the server.
Can anyone tell me if I'm wrong in its usage or another way to accomplish its function "rather than adding more tables to the database"

Thanks for help.
WaelEgAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
crsankarConnect With a Mentor Commented:
You cannot use the iif statement in SQL Server. You can use CASE instead.

here is an example.

USE pubs

GO

SELECT      Category =
            CASE type
                  WHEN 'popular_comp' THEN 'Popular Computing'
                  WHEN 'mod_cook' THEN 'Modern Cooking'
                  WHEN 'business' THEN 'Business'
                  WHEN 'psychology' THEN 'Psychology'
                  WHEN 'trad_cook' THEN 'Traditional Cooking'
                  ELSE 'Not yet categorized'
            END,
      CAST(title AS varchar(25)) AS 'Shortened Title',
      price AS Price
FROM titles
WHERE price IS NOT NULL
ORDER BY type, price
COMPUTE AVG(price) BY type
GO
0
 
WaelEgAuthor Commented:
Thank you very much I'm still trying at the real project but it worked on an example.
Thanks again.
God guides all of us to the right path.
0
All Courses

From novice to tech pro — start learning today.