April 24, 2004 at 5:47 am
i have condition like this,in select querey i am also selection one field through diff select query but it throws syntax error for second select query,pls suggest
declare @zcmSBA_V_SUBSTATIONID varchar(15)
declare @zcmSBA_V_WONO varchar(6)
declare @zcmSBA_N_JONO numeric
declare @zcmSBA_I_COSTTYPE Int
declare @err int
DECLARE @retItems VARCHAR(1000)
DECLARE @retAllocAmts VARCHAR(1000)
SET @retItems =''
SET @retAllocAmts=''
SELECT
zcmSBA_V_TRXNO [TRX No],
zcmSBA_V_TRXDESC [Description],
zcmSBA_D_TRXDATE [Date],
zcmSBA_N_ACTUALAMT [Actual Amount],
zcmSBA_N_REMAMT [Rem Amt],
(
SELECT @retItems= RTRIM(zcmSBA_V_ITEMNO)
FROM ZCM_SBA A
WHERE
A.zcmSBA_V_SUBSTATIONID=B.zcmSBA_V_SUBSTATIONID AND
A.zcmSBA_V_WONO=B.zcmSBA_V_WONO AND
A.zcmSBA_N_JONO=B.zcmSBA_N_JONO AND
A.zcmSBA_V_TRXNO=B.zcmSBA_V_TRXNO
  [Items],
FROM
ZCM_SBA B
WHERE
b.zcmSBT_V_SUBSTATIONID = @zcmSBT_V_SUBSTATIONID and
b.zcmSBT_V_WONO = @zcmSBT_V_WONO and
b.zcmSBT_N_JONO= @zcmSBT_N_JONO
April 24, 2004 at 6:12 am
I think you have missed one parenthesis and added a comma extra
declare @zcmSBA_V_SUBSTATIONID varchar(15)
declare @zcmSBA_V_WONO varchar(6)
declare @zcmSBA_N_JONO numeric
declare @zcmSBA_I_COSTTYPE Int
declare @err int
DECLARE @retItems VARCHAR(1000)
DECLARE @retAllocAmts VARCHAR(1000)
SET @retItems =''
SET @retAllocAmts=''
SELECT
zcmSBA_V_TRXNO [TRX No],
zcmSBA_V_TRXDESC [Description],
zcmSBA_D_TRXDATE [Date],
zcmSBA_N_ACTUALAMT [Actual Amount],
zcmSBA_N_REMAMT [Rem Amt],
(
SELECT @retItems= RTRIM(zcmSBA_V_ITEMNO)
FROM ZCM_SBA A
WHERE
A.zcmSBA_V_SUBSTATIONID=B.zcmSBA_V_SUBSTATIONID AND
A.zcmSBA_V_WONO=B.zcmSBA_V_WONO AND
A.zcmSBA_N_JONO=B.zcmSBA_N_JONO AND
A.zcmSBA_V_TRXNO=B.zcmSBA_V_TRXNO)
[Items]
FROM
ZCM_SBA B
WHERE
b.zcmSBT_V_SUBSTATIONID = @zcmSBT_V_SUBSTATIONID and
b.zcmSBT_V_WONO = @zcmSBT_V_WONO and
b.zcmSBT_N_JONO= @zcmSBT_N_JONO
Thanks
Prasad Bhogadi
www.inforaise.com
April 24, 2004 at 6:57 am
no that was mistake but it is giving same error
thanks
April 25, 2004 at 7:52 pm
"@retItems=" seems misplaced. Don't know what you're trying to do. Either have all result columns put to variables, or none.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply