Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread the number of SELECT column must match the number of INTO clause parameters
Tue, Sep 11 2012 12:13 AMPermanent Link

IQA

Hi All,

I know what the error means, but the columns appear to match exactly to
the columns I'm trying to insert into, in both the number and the column
type.

ElevateDB Error #700 An error was found in the statement at line 2 and
column 6 (Invalid expression  found, the number of SELECT column must
match the number of INTO clause parameters)

Any ideas ? Heres the SQL

Select F.forecastdate, 0 stay_overs, 0 room_arrivals, 0 room_departures,
Coalesce(Count(R.guestID),0) rooms_occupied, SUM(adults + children) guests
Into forecast
From forecastdates F
inner join reservation R on (CAST(R.ar_time AS DATE) =
CAST(F.forecastdate AS DATE))
OR (CAST(ar_time AS DATE) < CAST(F.forecastdate AS DATE) AND
CAST(R.dep_time AS DATE) >  CAST(F.forecastdate AS DATE))
Group by forecastdate!

Thanks,

Phil.
Tue, Sep 11 2012 12:51 AMPermanent Link

IQA

It's OK... I was porting code over from a DBISAM app...

So I just changed the way I was INSERTING... (works ok now)

INSERT INTO forecast (forecastdate, stay_overs, room_arrivals,
room_departures, rooms_occupied, guests)

Select F.forecastdate, 0 stay_overs, 0 room_arrivals, 0 room_departures,
Coalesce(Count(R.guestID),0) rooms_occupied, SUM(adults + children) guests
Into forecast
From forecastdates F
inner join reservation R on (CAST(R.ar_time AS DATE) =
CAST(F.forecastdate AS DATE))
OR (CAST(ar_time AS DATE) < CAST(F.forecastdate AS DATE) AND
CAST(R.dep_time AS DATE) >  CAST(F.forecastdate AS DATE))
Group by forecastdate!
Tue, Sep 11 2012 3:14 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Phil,

<< It's OK... I was porting code over from a DBISAM app...

So I just changed the way I was INSERTING... (works ok now) >>

Yep, the INTO clause for SELECT statements is now SQL-standard and is used
to output single-row values into parameters.

Tim Young
Elevate Software
www.elevatesoft.com


Image