Hi,
I am using output parameters in one of the stored procedures and am calling this stored proc in another stored proc.
But I am getting this error:
Msg 164, Level 15, State 1, Line 10
Each GROUP BY expression must contain at least one column that is not an outer reference.
Msg 164, Level 15, State 1, Line 15
Each GROUP BY expression must contain at least one column that is not an outer reference.
How can I use output parameters to get the output?
I am using output parameters in one of the stored procedures and am calling this stored proc in another stored proc.
But I am getting this error:
Msg 164, Level 15, State 1, Line 10
Each GROUP BY expression must contain at least one column that is not an outer reference.
Msg 164, Level 15, State 1, Line 15
Each GROUP BY expression must contain at least one column that is not an outer reference.
How can I use output parameters to get the output?
Code:
DECLARE
@FirstCcy varchar(7),
@SecondCcy varchar(7),
@Volume1 NUMERIC(18,2),
@Volume2 NUMERIC(18,2)
EXEC [pTest_FTDM_Details] '07-17-2008', '07-23-2008', @FirstCcy OUTPUT, @SecondCcy OUTPUT, @Volume1 OUTPUT, @Volume2 OUTPUT
--SUM UP the volume for each currency(FirstCcy)
Select @Volume1 AS CcyVolume, @FirstCcy AS Ccy
Into #A
GROUP BY @FirstCcy
--SUM UP the volume for each currency(SecondCcy)
Insert Into #A
Select @Volume2, @SecondCcy
GROUP BY @SecondCcy
---Output the data
--SUM UP the volume for each currency
Select Ccy AS Currency, SUM(CcyVolume) AS CurrencyVolume
From #B
Group By Ccy