在更新语句中使用表值函数 [英] Using table-valued function in update statement

查看:34
本文介绍了在更新语句中使用表值函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试执行以下更新语句:

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 显示以下错误:

SQL Server displays the following errors:

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

使用交叉应用

这篇关于在更新语句中使用表值函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆