IIF function in sql statement equal to what is used in Access-Query 
Author Message
 IIF function in sql statement equal to what is used in Access-Query
Hi all,
I hava a Sql statemnet generated by Access query as simple
as this:
  Select Detail.*,IIF(memeber=TRUE and
paid=FALSE,List*20,List)  From Detail;

this works fine in access but Running it in SQL Query
Analyzer doest not recognize IIF function and i am getting
eroor message. how can I put a criteria like this on the
field in SQLServer .
Thanx,
Sahar



Tue, 02 Nov 2004 03:53:41 GMT
 IIF function in sql statement equal to what is used in Access-Query

You will need to convert IIF to CASE.
Examples within Books Online.

--
Keith, SQL Server MVP


Quote:
> Hi all,
> I hava a Sql statemnet generated by Access query as simple
> as this:
>   Select Detail.*,IIF(memeber=TRUE and
> paid=FALSE,List*20,List)  From Detail;

> this works fine in access but Running it in SQL Query
> Analyzer doest not recognize IIF function and i am getting
> eroor message. how can I put a criteria like this on the
> field in SQLServer .
> Thanx,
> Sahar



Tue, 02 Nov 2004 04:00:39 GMT
 IIF function in sql statement equal to what is used in Access-Query
  SELECT
        Detail.*,
        CASE
            WHEN memeber=TRUE and paid=FALSE THEN List*20
            ELSE List END
    From Detail

- Anith


Quote:
> Hi all,
> I hava a Sql statemnet generated by Access query as simple
> as this:
>   Select Detail.*,IIF(memeber=TRUE and
> paid=FALSE,List*20,List)  From Detail;

> this works fine in access but Running it in SQL Query
> Analyzer doest not recognize IIF function and i am getting
> eroor message. how can I put a criteria like this on the
> field in SQLServer .
> Thanx,
> Sahar



Tue, 02 Nov 2004 04:02:43 GMT
 IIF function in sql statement equal to what is used in Access-Query
Anith,thank u so much!! :-)

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Tue, 02 Nov 2004 04:26:52 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. Using IIF Function in Sql Server 2000 Query ?

2. IIf function for this Microsoft Access query?

3. ADO using Access database queries with IIF problem

4. Access 97 - SQL 7. iif statement conversion

5. HELP: must convert IIF( ) from Access queries to T-SQL

6. Migrate MS-Access to SQL-Server - iif construction in aggregation query failes

7. Using IIF - SQL Server and Access

8. IIF function in query

9. IIF Function simulation in update queries??

10. About using iif and other functions

11. iif statement in a query

12. IIF Statements - Microsoft Access


 
Powered by phpBB® Forum Software