Group:  Microsoft Access ยป microsoft.public.access.odbcclientsvr
Thread: iif (immediate if) in pass through query?

Geek News

iif (immediate if) in pass through query?
Crossh 6/12/2007 2:52:02 PM
Can the IIF statement be used in a pass through query? I copied a query that
works fine in Access, but when I changed it to a pass through query and tried
to run it, I get an error ODBC--call failed [Microsoft][ODBC SQL Server
Driver][SQL Server]Line1: Incorrect syntax near '='.(#170).

Here' the code:
Sum(IIf([ActualCostRevised]=0,[CostReduction],[CostReductionRevised])) AS
CostReduction1
Re: iif (immediate if) in pass through query?
Stefan Hoffmann <stefan.hoffmann[ at ]explido.de> 6/12/2007 3:10:54 PM
hi,

Crossh wrote:
[Quoted Text]
> Can the IIF statement be used in a pass through query?
Depends on the destination of your passthrough query. The backend
executing it, must know it.

> I copied a query that
> works fine in Access, but when I changed it to a pass through query and tried
> to run it, I get an error ODBC--call failed [Microsoft][ODBC SQL Server
> Driver][SQL Server]Line1: Incorrect syntax near '='.(#170).
The SQL Server has not Iif, thus the error message. Use the CASE
statement instead:

SUM(CASE WHEN
[ActualCostRevised]=0
THEN
[CostReduction]
ELSE
[CostReductionRevised]
END) AS CR

mfG
--> stefan <--
Re: iif (immediate if) in pass through query?
Crossh 6/13/2007 2:02:01 PM
Thanks so much, worked like a charm.

"Stefan Hoffmann" wrote:

[Quoted Text]
> The SQL Server has not Iif, thus the error message. Use the CASE
> statement instead:
>
> SUM(CASE WHEN
> [ActualCostRevised]=0
> THEN
> [CostReduction]
> ELSE
> [CostReductionRevised]
> END) AS CR
>
> mfG
> --> stefan <--
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net