简体   繁体   English

在update语句中使用表值函数

[英]Using table-valued function in update statement

I'm trying to execute the following update statement: 我正在尝试执行以下更新语句:

Update belege2  
Set Preis_Einh = x.Preis, Aktion=x.Aktion, PreisHerk = x.PreisHerk 
FROM dbo.GetPreis(belege2.prodkey, belege2.Anzahl) x
where belege2.Beleg_Nr = 13599

SQL Server displays the following errors: SQL Server显示以下错误:

Msg 4104, Level 16, State 1, Line 3
The multi-part identifier "belege2.prodkey" could not be bound.

Msg 4104, Level 16, State 1, Line 3
The multi-part identifier "belege2.Anzahl" could not be bound.

Is this not supported? 这不受支持吗? Is there a workaround? 有解决方法吗?

did u try this with alias.. 你用别名试试这个吗?

Update b  
Set b.Preis_Einh = x.Preis, b.Aktion=x.Aktion, b.PreisHerk = x.PreisHerk 
FROM belege2 b cross apply dbo.GetPreis(b.prodkey, b.Anzahl) x 
where b.Beleg_Nr = 13599

used cross apply 使用交叉申请

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM