从表值函数更新虚拟表,需要从虚拟表传参数进去,一直报这个错,求教该怎么写才对?
select acc.yto_sapcode,yas.yto_accountName,yas.yto_account,
0 as qichu,0 as yingshou,0 as threeMonth,0 as sixMonth,0 as twelveMonth,0 as twoYear,0 as threeYear,0 as beforeThreeYear
into #table
from yto_accountsreceivable yas
left join Account acc on yas.yto_account=acc.AccountId
where yas.statecode=0 and acc.StateCode=0 and acc.yto_accounttype=1
group by yas.yto_accountName,yas.yto_account,acc.yto_sapcode
update #table set #table.qichu=fn.qichu,#table.yingshou=fn.yingshou,#table.threeMonth=fn.threeMonth
from dbo.Frensworkz_getCYJzhujichangXY_Report(#table.yto_account,@endDateUTC) as fn
update #table
set #table.qichu=fn.qichu,#table.yingshou=fn.yingshou,#table.threeMonth=fn.threeMonth
from #table cross apply
dbo.Frensworkz_getCYJzhujichangXY_Report(#table.yto_account,@endDateUTC) as fn