我收到错误:
无法绑定多部分标识符“tbl.pendingeffort”。
执行此存储过程时:
CREATE PROCEDURE [dbo].[spc_updateStudyPlan]
@studyplandt StudyPlanType READONLY
AS
BEGIN
UPDATE studyplan SET tbl.pendingeffort = dt.effortinminutes
FROM @studyplandt dt Inner join studyPlan tbl ON tbl.id = dt.id
END
你能帮我解决这个问题吗?
答案 0 :(得分:0)
您不能在SET
子句中的赋值左侧使用别名。你也不需要,你已经确定在UPDATE
关键字之后更新了哪个表:
UPDATE studyplan SET pendingeffort = dt.effortinminutes
FROM @studyplandt dt Inner join studyPlan tbl ON tbl.id = dt.id
/* ^
|
|This is the only table that the UPDATE statement can affect */