Re: remote views vs spt by Paul
Paul
Tue Nov 30 13:57:07 CST 2004
The actual view I'm trying to create is more complex than this, but this
contains most of the relevant elements:
SELECT events.timeslot, events.leader1, ;
SUM(IIF(attendance.paymethod = 'CASH' AND NOT attendance.reversed,
attendance.amount, $0)) AS cashrec ;
FROM events ;
LEFT OUTER JOIN attendance ON events.eventid = attendance.eventid ;
WHERE events.startdt >= ?startDate AND events.startdt <= ?endDate ;
GROUP BY events.leader1, events.timeslot
gives: Connectivity error: [Microsoft][ODBC SQL Server Driver][SQL
Server]Line 1: Incorrect syntax near '='.
and
SELECT events.timeslot, events.leader1, ;
SUM(CASE WHEN attendance.paymethod = 'CASH' AND attendance.reversed = 0 THEN
attendance.amount ELSE $0.00 END) AS cashrec ;
FROM events ;
LEFT OUTER JOIN attendance ON events.eventid = attendance.eventid ;
WHERE events.startdt >= ?startDate AND events.startdt <= ?endDate ;
GROUP BY events.leader1, events.timeslot
gives: Function name is missing ).
If I run a query similar to the second one (removing semicolons etc.) in the
SQL Query Analyzer, it works fine.
I've heard that there are limits what can be done with remote views. Perhaps
I have reached one of them.
(I'm using VFP9 beta.)
"Rick Bean" <rgbean@unrealmelange-inc.com> wrote in message
news:uSboQFx1EHA.1188@tk2msftngp13.phx.gbl...
Paul,
Because of newsgroup reformating and your simplified version, it's difficult
to guess what the problem is, especially without knowing the actual wording
of the error message. Any reason you can't just post the whole select AND
the error message text?
Rick
"Paul Pedersen" <no-reply@swen.com> wrote in message
news:edgiB6w1EHA.1292@TK2MSFTNGP10.phx.gbl...
> I've been trying unsuccessfully to create a SQL Server remote view on a
> query like this (simplified):
>
> SELECT events.timeslot, events.leader1,
> SUM(IIF(attendance.paymethod = 'CASH' AND NOT attendance.reversed,
> attendance.amount, $0) AS cashrec
> FROM events
> LEFT OUTER JOIN attendance ON events.eventid = attendance.eventid
> WHERE events.startdt >= ?startDate AND events.startdt <= ?endDate
> GROUP BY events.leader1, events.timeslot
>
> This gets SQL error messages.
>
>
> I've tried using T-SQL too, like this:
>
> SUM(CASE WHEN attendance.paymethod = 'CASH' AND attendance.reversed = 0
> THEN
> attendance.amount ELSE $0.00 END) AS cashrec
>
> ... but this gets VFP error messages.
>
>
> Is it possible to make a remote view like this or should I give up and use
> SPT?
>
>
>
>