Re: Access Project

From: Ron Weiner (weinNoSpam1_at_mindspring.com)
Date: 10/08/04


Date: Fri, 8 Oct 2004 08:19:57 -0400

Dib

Although I have never worked in an Access ADP I believe you need to use TSQL
syntax (as Sql Server is the database engine), and as you have discovered
there is no IIF() in TSQL.

You probably want to replace the IIF() constructs with TSQL CASE function.
Sql Server BOL has a good explanation and lots of examples. For your
specific example it might translate like this:

SELECT This, That,
CASE Type
    WHEN 1 THEN Cost*UnitSell
    ELSE 0
END AS AndTheOther
FROM WhateverTable
WHERE SomeCondition
ORDER BY This, That, AndTheOther

CASE is far more flexible (and structured) than the IIF() function
especially when one has many WHEN conditions.

Ron W

"Dib" <dNOSPAMshahene@conNOSPAMsoftware.com> wrote in message
news:u1XmkNJrEHA.2696@TK2MSFTNGP15.phx.gbl...
> Hi,
>
> How can I make this part of the sql work in a Access Project (.ADP)
>
> SUM(IIF(Type=1,Cost*UnitSell,0))
>
> this is returning and synetx near =
>
> Thanks
> Dib
>
>



Relevant Pages

  • Re: Why Oracle does not allow rollback of DDL statements?
    ... TSQL did suffer from a lack of modern exception handling. ... So I think we cannot blame transactional DDL for lacking of exception handlers. ... When porting SQL Server apps to another DBMS the problem of lost errors is a major issue in general since TSQL developers have this nasty tendency to only do error checking wherher they think an error could appear. ...
    (comp.databases.oracle.server)
  • Re: DTS object model
    ... Can I do validation & mapping, if I use BulkInsert Command in TSQL? ... Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) ... I want to create a text file connection and set the ...
    (microsoft.public.sqlserver.dts)
  • Re: Importing Multiple text files into one sql table
    ... >the working table you then need to run a series of TSQL ... >ExecuteSQL task. ... >www.allisonmitchell.com - Expert SQL Server Consultancy. ...
    (microsoft.public.sqlserver.dts)
  • Re: DTS and DB2/400
    ... If you want the Key then you will have to rewrite to TSQL and apply ... Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) ... > I am in the process of migrating my database from DB2/400 to SQL Server ... A table with a primary key is being migrated without the primary key ...
    (microsoft.public.sqlserver.dts)
  • Re: SQL Server - Filter
    ... match their selection criteria. ... > and Sql Server and what worked for me. ... > have millions of records, then yes, you can write regular Access queries ... is to write my tSql statements through com ADO. ...
    (comp.databases.ms-access)