By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,516 Members | 1,183 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,516 IT Pros & Developers. It's quick & easy.

Why dosn't IIF work here?

P: n/a
Hi,
I have the following query: (Simplified version for testing)

SELECT IIF(MonAM='S','YES','NO') as IsSick
FROM tblAbsence

This works prfectly in Access, SQL Server won't like it.
I have tried every alteration I can think of but still nothing.
This is so simple I can't believe I can't get it working.
Can anyone tell me what's wrong and let me know what I should be doing
to obtain this functionality?

Thanks
Robert

Sep 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
SQL Server has no idea about IIF, here you have to refer to CASE. (BOL)

SELECT CASE MonAM WHEN 'S' THEN 'YES' ELSE 'NO' END as IsSick
FROM tblAbsence

HTH, Jens Suessmeyer.

Sep 15 '05 #2

P: n/a
IIF exists only in Access, not MSSQL. The SQL equivalent is CASE - see
Books Online for examples.

Simon

Sep 15 '05 #3

P: n/a
tsql is a LOT more powerful and exciting than access.. i hope you stick
with mssql.. it's a lot of fun

Sep 28 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.