What is the equivalent of the IIF command in SQL Server   Leave a comment

–In MS 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

Advertisements

Posted November 22, 2014 by Izharuddin Shaikh in SQL

Tagged with

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: