473,385 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Why dosn't IIF work here?

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
3 1371
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
IIF exists only in Access, not MSSQL. The SQL equivalent is CASE - see
Books Online for examples.

Simon

Sep 15 '05 #3
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ALI-R | last post by:
I am using the follwoing code to get all files which have txt as an extension but I get an error that your search pattern is not correct.it seems this fuction dosn't accept "*.txt" as search...
2
by: ALI-R | last post by:
I have a config file in my app ,,called app.config.it works fine in debug but when I deploy application it has no effect.Any suggestion?? Thanks for your help. Here is my app.config ?xml...
5
by: Ray Alirezaei | last post by:
Hi all When I copy and paste a piece of code from a web page into IDE ,,it is well formatted and instead of "<" or ">" characters "&alt" shows up.why is that ? Thanks for your help in advance....
4
by: Ahmed Hazzaa | last post by:
Hi all, I'm using the ASP.net 2.0 Beta 1, and in the html section of my page the asp tags dosn't appear, and i get a warning if i wrote them. Any help
4
by: Reza | last post by:
checkedListBox1.ClearSelected(),dosn't clear my selections in my checkedboxlist. How can I clear an specific item based on its value ,name or anything else? thanks for your response.
15
by: Brett | last post by:
I'd like to know what management and the work environment are like where you work. I need something relative to compare my current work environment. Here's a few questions I have: 1.) Is it...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
48
by: Jimmy | last post by:
thanks to everyone that helped, unfortunately the code samples people gave me don't work. here is what i have so far: <% Dim oConn, oRS, randNum Randomize() randNum = (CInt(1000 * Rnd) + 1) *...
14
by: Jonas.Holmsten | last post by:
Hello I'm porting some C++ stuff to C and having problem to get it through gcc. Here is a condensed version of the problem: void foo(const int * const * const ptr) {} main()
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.