Hi,
You cannot use a string variable in IN clause like that. One way would be that you concatenate the string value in @accNo1 to your SQL statement, but I don't suggest you do that. Instead place the query to get account numbers in your summary statement. Something like:
set @SQLString=N'Select sum(case when fmgl.dr_cr=''DR'' then fmgl.amount_tk else -amount_tk end) as Amount
From balance fmgl
Where fmgl.tdate < ''30-Sep-2010''
and fmgl.accountno in (select rcb.gl_accno_cbs
from particulars_reports pr
Inner Join reports rp on pr.rpt_id=rp.rpt_id
Inner Join particulars p on p.particular_id=pr.particular_id
Inner Join rmu_cbs_border rcb on rcb.particular_id=pr.particular_id
Where rp.rpt_id=3 and p.particular_id=9)';
Regards,
mika