Solved

question about iff

Posted on 2014-03-12
3
200 Views
Last Modified: 2014-03-13
Hello,

I try select distinct d.LegalName, IIF ( (et.Description = 'VA'), 'YES', 'NO' )  as 'WITHOUT VA', a.* from ##CPTE a

The following error is returned :
Incorrect syntax near '='.

How can I resolve it?

Thanks
0
Comment
Question by:bibi92
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 66

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 39924910
SQL Server doesn't do IIF, it does CASE.

SELECT DISTINCT
   d.LegalName,
   CASE WHEN et.Description = 'VA' THEN 'Yes' ELSE 'NO' END as Without_VA,
-- the rest goes here

For more info on CASE blocks there's an article out there on SQL Server CASE Solutions if that helps.
0
 

Author Closing Comment

by:bibi92
ID: 39925687
Thanks
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 39926123
Thanks for the grade.  Good luck with your project.  -Jim
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question